diff --git a/Codeforces.Test/input.txt b/Codeforces.Test/Input/1 similarity index 100% rename from Codeforces.Test/input.txt rename to Codeforces.Test/Input/1 diff --git a/Codeforces.Test/Input/2 b/Codeforces.Test/Input/2 new file mode 100644 index 0000000..7b48096 --- /dev/null +++ b/Codeforces.Test/Input/2 @@ -0,0 +1,6 @@ +5 +256 42 +1000 1000 +-1000 1000 +-1000 1000 +20 22 diff --git a/Codeforces.Test/output.txt b/Codeforces.Test/Output/1.a similarity index 100% rename from Codeforces.Test/output.txt rename to Codeforces.Test/Output/1.a diff --git a/Codeforces.Test/Output/2.a b/Codeforces.Test/Output/2.a new file mode 100644 index 0000000..2fea631 --- /dev/null +++ b/Codeforces.Test/Output/2.a @@ -0,0 +1,5 @@ +298 +2000 +0 +0 +42 diff --git a/Codeforces.Test/Tests.cs b/Codeforces.Test/Tests.cs index d9de594..076b477 100644 --- a/Codeforces.Test/Tests.cs +++ b/Codeforces.Test/Tests.cs @@ -1,17 +1,21 @@ +using System.Collections; + namespace Codeforces.Test; public class Tests { - [Fact] - public void TestIO() + + [Theory] + [ClassData(typeof(FileNameGenerator))] + public void TestIO(string input, string output) { IOTester.Start(); - var lines = File.ReadLines(@"..\..\..\input.txt"); + var lines = File.ReadLines(input); IOTester.SetInput(lines.ToArray()); Program.Main(); - string[] expectedOutput = File.ReadLines(@"..\..\..\output.txt").ToArray(); + string[] expectedOutput = File.ReadLines(output).ToArray(); string[] actualOutput = IOTester.GetOutputLines(); Assert.Equal(expectedOutput.Length, actualOutput.Length); for (int i = 0; i < expectedOutput.Length; i++) @@ -19,4 +23,19 @@ public class Tests Assert.Equal(expectedOutput[i], actualOutput[i]); } } +} +public class FileNameGenerator : IEnumerable +{ + private readonly string inputFolder = @"..\..\..\Input"; + public IEnumerator 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(); } \ No newline at end of file