From 9fb4a077cb772617aa4b0f1af0b211e47673af24 Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Fri, 11 Aug 2023 08:04:22 +0300 Subject: [PATCH] Add simple test --- Codeforces.Test/Tests.cs | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) 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 }; } }