forked from xy-kasumi/hs2bf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-test
More file actions
executable file
·52 lines (42 loc) · 1.19 KB
/
auto-test
File metadata and controls
executable file
·52 lines (42 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env fish
# test_bf ::
# FilePath -> -- ^ Haskell code to be compiled and run
# String -> -- ^ Expected output
# IO ()
function test_bf
set hs_path $argv[1]
set base (basename $argv[1] .hs)
mkdir -p .golden
set bf_path .golden/$base.bf
set expected $argv[2]
echo "=== $hs_path ==="
rm -f $bf_path
set hs2bf_bin (cabal list-bin hs2bf-exe)
echo $hs2bf_bin
$hs2bf_bin --make $hs_path > $bf_path
set result (time 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 examples/Halt.hs ""
and test_bf examples/Const.hs "~"
and test_bf examples/ExplicitCase.hs "o"
and test_bf examples/Hello.hs "Hello!"
and test_bf examples/LocalFun.hs "~"
and test_bf examples/Lambda.hs "A"
and test_bf examples/Arithmetic.hs "o"
and test_bf examples/ShowList.hs "123"
and test_bf examples/QuickSort.hs "best"
# and test_bf examples/TypeClass.hs
# and test_bf examples/ConstPattern.hs
# and test_bf examples/