1
0

Add simple test

This commit is contained in:
Serghei Cebotari 2023-08-11 08:04:22 +03:00
parent 2c4eb6c1f5
commit 9fb4a077cb

View File

@ -4,6 +4,37 @@ namespace Codeforces.Test;
public class Tests
{
[Fact]
public void TestText()
{
IOTester.Start();
string[] input = new[]
{
"5",
"256 42",
"1000 1000",
"-1000 1000",
"-1000 1000",
"20 22"
};
IOTester.SetInput(input);
Program.Main();
string[] expectedOutput = new[]
{
"298",
"2000",
"0",
"0",
"42"
};
string[] actualOutput = IOTester.GetOutputLines();
Assert.Equal(expectedOutput.Length, actualOutput.Length);
for (int i = 0; i < expectedOutput.Length; i++)
{
Assert.Equal(expectedOutput[i], actualOutput[i]);
}
}
[Theory]
[ClassData(typeof(FileNameGenerator))]
@ -28,12 +59,12 @@ public class FileNameGenerator : IEnumerable<object[]>
{
private readonly string inputFolder = @"..\..\..\Input";
public IEnumerator<object[]> GetEnumerator()
{
{
foreach (var input in Directory.GetFiles(inputFolder))
{
string name = Path.GetFileName(input);
string output = $"..\\..\\..\\Output\\{name}.a";
yield return new object[] {input, output};
yield return new object[] { input, output };
}
}