From 5858b0266f2ea120993ea79daa6256d75123a092 Mon Sep 17 00:00:00 2001 From: sfphoton <schulcz.ferenc@gmail.com> Date: Fri, 6 Apr 2018 12:26:40 +0200 Subject: [PATCH] Tester script for proto added --- tester.ps1 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tester.ps1 diff --git a/tester.ps1 b/tester.ps1 new file mode 100644 index 0000000..9f0565d --- /dev/null +++ b/tester.ps1 @@ -0,0 +1,41 @@ +function test([string]$testfile, [string]$expectedfile) { + $expResult = cat $expectedfile + + $input = cat $testfile + $output = echo $input | java -cp .\class\ killer_sokoban.Main + + $diff = compare $output $expResult + + if ($diff.Length -eq 0) { + echo "Test with test file $testfile passed." + } else { + echo "Test with test file $testfile FAILED!" + echo "Got:" + echo "-------------------------------------" + echo $output + echo "Expected:" + echo "-------------------------------------" + echo $expResult + } +} + +function testAll() { + $tfiles = dir -fi "*.in" -Name + + foreach ($item in $tfiles) { + $temp = $item.Substring(0, $item.LastIndexOf('.')) + + test $item "$temp.out" + } +} + +#main + +if ($args.Count -eq 0) { + testAll +} elseif($args.Count -eq 2) { + test $args[0] $args[1] +} else { + echo "Wrong number of arguments!" +} + -- GitLab