diff --git a/Codeforces.Test/Tests.cs b/Codeforces.Test/Tests.cs index 076b477..2518e85 100644 --- a/Codeforces.Test/Tests.cs +++ b/Codeforces.Test/Tests.cs @@ -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 { 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}; + yield return new object[] { input, output }; } }