diff options
Diffstat (limited to 'Codeforces.Test/Tests.cs')
-rw-r--r-- | Codeforces.Test/Tests.cs | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/Codeforces.Test/Tests.cs b/Codeforces.Test/Tests.cs index 9623788..161a779 100644 --- a/Codeforces.Test/Tests.cs +++ b/Codeforces.Test/Tests.cs @@ -1,16 +1,14 @@ -using System.Collections; - namespace Codeforces.Test; public class Tests { - [Fact(Timeout = 30000)] - public void TestText() + [Fact(Timeout = 5000)] + public async Task TestFromText() { IOTester.Start(); string[] input = - [ - "5", + [ + "5", "256 42", "1000 1000", "-1000 1000", @@ -19,10 +17,10 @@ public class Tests ]; IOTester.SetInput(input); - Program.Main(); + await Task.Run(Program.Main); string[] expected = - [ - "298", + [ + "298", "2000", "0", "0", @@ -32,33 +30,18 @@ public class Tests Assert.Equal(expected, actual); } - [Theory(Timeout = 30000)] + [Theory(Timeout = 5000)] [ClassData(typeof(FileNameGenerator))] - public void TestIO(string input, string output) + public async Task TestFromFiles(string input, string output) { IOTester.Start(); var lines = File.ReadLines(input); IOTester.SetInput(lines.ToArray()); - Program.Main(); + await Task.Run(Program.Main); var expectedOutput = File.ReadLines(output); var actualOutput = IOTester.GetOutputLines(); Assert.Equal(expectedOutput, actualOutput); } -} -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(); }
\ No newline at end of file |