forked from xy-kasumi/hs2bf
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make auto-test actually compare output.
- Loading branch information
Showing
3 changed files
with
60 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,46 @@ | ||
#!/bin/env fish | ||
|
||
# test_bf :: | ||
# FilePath -> -- ^ Haskell code to be compiled and run | ||
# String -> -- ^ Expected output | ||
# IO () | ||
function test_bf | ||
echo "=== $argv[1] ===" | ||
rm -f test/(basename $argv[1] .hs).bf | ||
dist/build/hs2bf/hs2bf --make $argv[1] > test/(basename $argv[1] .hs).bf | ||
time -f 'user:%U sys:%S' bfi/bfi test/(basename $argv[1] .hs).bf | ||
set hs_path $argv[1] | ||
set bf_path test/(basename $argv[1] .hs).bf | ||
set expected $argv[2] | ||
|
||
echo "=== $hs_path ===" | ||
|
||
rm -f $bf_path | ||
dist/build/hs2bf/hs2bf --make $hs_path > $bf_path | ||
|
||
set result (time -f 'user:%U sys:%S' bfi/bfi $bf_path) | ||
|
||
if test "$result" = "$expected" | ||
set_color green | ||
echo "PASSED" | ||
set_color normal | ||
else | ||
set_color red | ||
echo "FAILED" | ||
set_color normal | ||
echo "expected: " $expected | ||
echo "actual: " $result | ||
end | ||
|
||
echo "" | ||
end | ||
|
||
|
||
test_bf test/Halt.hs | ||
and test_bf test/Const.hs | ||
and test_bf test/ExplicitCase.hs | ||
and test_bf test/Hello.hs | ||
and test_bf test/LocalFun.hs | ||
and test_bf test/Lambda.hs | ||
and test_bf test/Arithmetic.hs | ||
and test_bf test/ShowList.hs | ||
and test_bf test/QuickSort.hs | ||
test_bf test/Halt.hs "" | ||
and test_bf test/Const.hs "~" | ||
and test_bf test/ExplicitCase.hs "o" | ||
and test_bf test/Hello.hs "Hello!" | ||
and test_bf test/LocalFun.hs "~" | ||
and test_bf test/Lambda.hs "A" | ||
and test_bf test/Arithmetic.hs "o" | ||
and test_bf test/ShowList.hs "123" | ||
and test_bf test/QuickSort.hs "best" | ||
# and test_bf test/TypeClass.hs | ||
# and test_bf test/ConstPattern.hs | ||
# and test_bf test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters