1
0
codeforces-template/Codeforces.Test/Tests.cs

47 lines
877 B
C#
Raw Normal View History

2023-08-09 09:42:50 +03:00
namespace Codeforces.Test;
public class Tests
{
2023-12-07 22:29:25 +03:00
[Fact(Timeout = 5000)]
public async Task TestFromText()
2023-08-11 08:04:22 +03:00
{
IOTester.Start();
2023-12-07 21:44:13 +03:00
string[] input =
2023-12-07 22:29:25 +03:00
[
"5",
2023-08-11 08:04:22 +03:00
"256 42",
"1000 1000",
"-1000 1000",
"-1000 1000",
"20 22"
2023-12-07 21:44:13 +03:00
];
2023-08-11 08:04:22 +03:00
IOTester.SetInput(input);
2023-12-07 22:29:25 +03:00
await Task.Run(Program.Main);
2023-12-07 21:44:13 +03:00
string[] expected =
2023-12-07 22:29:25 +03:00
[
"298",
2023-08-11 08:04:22 +03:00
"2000",
"0",
"0",
"42"
2023-12-07 21:44:13 +03:00
];
string[] actual = IOTester.GetOutputLines().ToArray();
Assert.Equal(expected, actual);
2023-08-11 08:04:22 +03:00
}
2023-08-10 14:17:08 +03:00
2023-12-07 22:29:25 +03:00
[Theory(Timeout = 5000)]
2023-08-10 14:17:08 +03:00
[ClassData(typeof(FileNameGenerator))]
2023-12-07 22:29:25 +03:00
public async Task TestFromFiles(string input, string output)
2023-08-09 09:42:50 +03:00
{
IOTester.Start();
2023-08-10 14:17:08 +03:00
var lines = File.ReadLines(input);
2023-08-09 17:06:42 +03:00
IOTester.SetInput(lines.ToArray());
2023-08-09 09:42:50 +03:00
2023-12-07 22:29:25 +03:00
await Task.Run(Program.Main);
2023-08-09 09:42:50 +03:00
2023-12-07 21:44:13 +03:00
var expectedOutput = File.ReadLines(output);
var actualOutput = IOTester.GetOutputLines();
Assert.Equal(expectedOutput, actualOutput);
2023-08-09 09:42:50 +03:00
}
}