Implement multiple files tests
This commit is contained in:
parent
ded4e141ee
commit
2c4eb6c1f5
6
Codeforces.Test/Input/2
Normal file
6
Codeforces.Test/Input/2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
5
|
||||||
|
256 42
|
||||||
|
1000 1000
|
||||||
|
-1000 1000
|
||||||
|
-1000 1000
|
||||||
|
20 22
|
5
Codeforces.Test/Output/2.a
Normal file
5
Codeforces.Test/Output/2.a
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
298
|
||||||
|
2000
|
||||||
|
0
|
||||||
|
0
|
||||||
|
42
|
@ -1,17 +1,21 @@
|
|||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace Codeforces.Test;
|
namespace Codeforces.Test;
|
||||||
|
|
||||||
public class Tests
|
public class Tests
|
||||||
{
|
{
|
||||||
[Fact]
|
|
||||||
public void TestIO()
|
[Theory]
|
||||||
|
[ClassData(typeof(FileNameGenerator))]
|
||||||
|
public void TestIO(string input, string output)
|
||||||
{
|
{
|
||||||
IOTester.Start();
|
IOTester.Start();
|
||||||
var lines = File.ReadLines(@"..\..\..\input.txt");
|
var lines = File.ReadLines(input);
|
||||||
IOTester.SetInput(lines.ToArray());
|
IOTester.SetInput(lines.ToArray());
|
||||||
|
|
||||||
Program.Main();
|
Program.Main();
|
||||||
|
|
||||||
string[] expectedOutput = File.ReadLines(@"..\..\..\output.txt").ToArray();
|
string[] expectedOutput = File.ReadLines(output).ToArray();
|
||||||
string[] actualOutput = IOTester.GetOutputLines();
|
string[] actualOutput = IOTester.GetOutputLines();
|
||||||
Assert.Equal(expectedOutput.Length, actualOutput.Length);
|
Assert.Equal(expectedOutput.Length, actualOutput.Length);
|
||||||
for (int i = 0; i < expectedOutput.Length; i++)
|
for (int i = 0; i < expectedOutput.Length; i++)
|
||||||
@ -20,3 +24,18 @@ public class Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user