aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerghei Cebotari <serghei@cebotari.ru>2023-08-10 14:17:08 +0300
committerSerghei Cebotari <serghei@cebotari.ru>2023-08-10 14:17:08 +0300
commit2c4eb6c1f5735d53679d33f0557a6c83b4b9c594 (patch)
tree681fe7f5860af02b6e4a26231fb6b6be1c206435
parentded4e141eec54200cda5a9446a2b9552eb30bdb4 (diff)
Implement multiple files tests
-rw-r--r--Codeforces.Test/Input/1 (renamed from Codeforces.Test/input.txt)0
-rw-r--r--Codeforces.Test/Input/26
-rw-r--r--Codeforces.Test/Output/1.a (renamed from Codeforces.Test/output.txt)0
-rw-r--r--Codeforces.Test/Output/2.a5
-rw-r--r--Codeforces.Test/Tests.cs27
5 files changed, 34 insertions, 4 deletions
diff --git a/Codeforces.Test/input.txt b/Codeforces.Test/Input/1
index 7b48096..7b48096 100644
--- a/Codeforces.Test/input.txt
+++ b/Codeforces.Test/Input/1
diff --git a/Codeforces.Test/Input/2 b/Codeforces.Test/Input/2
new file mode 100644
index 0000000..7b48096
--- /dev/null
+++ b/Codeforces.Test/Input/2
@@ -0,0 +1,6 @@
+5
+256 42
+1000 1000
+-1000 1000
+-1000 1000
+20 22
diff --git a/Codeforces.Test/output.txt b/Codeforces.Test/Output/1.a
index 2fea631..2fea631 100644
--- a/Codeforces.Test/output.txt
+++ b/Codeforces.Test/Output/1.a
diff --git a/Codeforces.Test/Output/2.a b/Codeforces.Test/Output/2.a
new file mode 100644
index 0000000..2fea631
--- /dev/null
+++ b/Codeforces.Test/Output/2.a
@@ -0,0 +1,5 @@
+298
+2000
+0
+0
+42
diff --git a/Codeforces.Test/Tests.cs b/Codeforces.Test/Tests.cs
index d9de594..076b477 100644
--- a/Codeforces.Test/Tests.cs
+++ b/Codeforces.Test/Tests.cs
@@ -1,17 +1,21 @@
+using System.Collections;
+
namespace Codeforces.Test;
public class Tests
{
- [Fact]
- public void TestIO()
+
+ [Theory]
+ [ClassData(typeof(FileNameGenerator))]
+ public void TestIO(string input, string output)
{
IOTester.Start();
- var lines = File.ReadLines(@"..\..\..\input.txt");
+ var lines = File.ReadLines(input);
IOTester.SetInput(lines.ToArray());
Program.Main();
- string[] expectedOutput = File.ReadLines(@"..\..\..\output.txt").ToArray();
+ string[] expectedOutput = File.ReadLines(output).ToArray();
string[] actualOutput = IOTester.GetOutputLines();
Assert.Equal(expectedOutput.Length, actualOutput.Length);
for (int i = 0; i < expectedOutput.Length; i++)
@@ -19,4 +23,19 @@ public class Tests
Assert.Equal(expectedOutput[i], actualOutput[i]);
}
}
+}
+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