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

47 lines
877 B
C#

namespace Codeforces.Test;
public class Tests
{
[Fact(Timeout = 5000)]
public async Task TestFromText()
{
IOTester.Start();
string[] input =
[
"5",
"256 42",
"1000 1000",
"-1000 1000",
"-1000 1000",
"20 22"
];
IOTester.SetInput(input);
await Task.Run(Program.Main);
string[] expected =
[
"298",
"2000",
"0",
"0",
"42"
];
string[] actual = IOTester.GetOutputLines().ToArray();
Assert.Equal(expected, actual);
}
[Theory(Timeout = 5000)]
[ClassData(typeof(FileNameGenerator))]
public async Task TestFromFiles(string input, string output)
{
IOTester.Start();
var lines = File.ReadLines(input);
IOTester.SetInput(lines.ToArray());
await Task.Run(Program.Main);
var expectedOutput = File.ReadLines(output);
var actualOutput = IOTester.GetOutputLines();
Assert.Equal(expectedOutput, actualOutput);
}
}