From ded4e141eec54200cda5a9446a2b9552eb30bdb4 Mon Sep 17 00:00:00 2001 From: Serghei Cebotari Date: Wed, 9 Aug 2023 17:06:42 +0300 Subject: [PATCH] Move test data to files --- Codeforces.Test/Tests.cs | 29 ++++++----------------------- Codeforces.Test/input.txt | 6 ++++++ Codeforces.Test/output.txt | 5 +++++ 3 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 Codeforces.Test/input.txt create mode 100644 Codeforces.Test/output.txt diff --git a/Codeforces.Test/Tests.cs b/Codeforces.Test/Tests.cs index a0cd87c..d9de594 100644 --- a/Codeforces.Test/Tests.cs +++ b/Codeforces.Test/Tests.cs @@ -6,34 +6,17 @@ public class Tests public void TestIO() { IOTester.Start(); - - string[] input = new string[] - { - "5", - "256 42", - "1000 1000", - "-1000 1000", - "-1000 1000", - "20 22" - }; - IOTester.SetInput(input); + var lines = File.ReadLines(@"..\..\..\input.txt"); + IOTester.SetInput(lines.ToArray()); Program.Main(); - string[] output = new string[] - { - "298", - "2000", - "0", - "0", - "42" - }; - + string[] expectedOutput = File.ReadLines(@"..\..\..\output.txt").ToArray(); string[] actualOutput = IOTester.GetOutputLines(); - Assert.Equal(output.Length, actualOutput.Length); - for (int i = 0; i< output.Length; i++) + Assert.Equal(expectedOutput.Length, actualOutput.Length); + for (int i = 0; i < expectedOutput.Length; i++) { - Assert.Equal(output[i], actualOutput[i]); + Assert.Equal(expectedOutput[i], actualOutput[i]); } } } \ No newline at end of file diff --git a/Codeforces.Test/input.txt b/Codeforces.Test/input.txt new file mode 100644 index 0000000..7b48096 --- /dev/null +++ b/Codeforces.Test/input.txt @@ -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.txt new file mode 100644 index 0000000..2fea631 --- /dev/null +++ b/Codeforces.Test/output.txt @@ -0,0 +1,5 @@ +298 +2000 +0 +0 +42