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 -{ - 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 diff --git a/Codeforces.Test/Usings.cs b/Codeforces.Test/Usings.cs index c1ede49..8c927eb 100644 --- a/Codeforces.Test/Usings.cs +++ b/Codeforces.Test/Usings.cs @@ -1,2 +1 @@ -global using Xunit; -global using Codeforces; \ No newline at end of file +global using Xunit; \ No newline at end of file