This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tests.hs
61 lines (53 loc) · 1.65 KB
/
Tests.hs
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
53
54
55
56
57
58
59
60
61
module Main
where
import System.Process
import System.IO
import System.Exit
import Control.Monad
main = do
(_,testH1,_,_) <- runInteractiveCommand $
"runhaskell Befunge.hs tests/mycology/mycology.b98"
test1 <- hGetContents testH1
(_,testH2,_,_) <- runInteractiveCommand $
"runhaskell Befunge.hs tests/phlamethrower/compat.bf"
test2 <- hGetContents testH2
(_,testH3,_,_) <- runInteractiveCommand $
"runhaskell Befunge.hs tests/phlamethrower/divtest.bf"
test3 <- hGetContents testH3
-- test output:
putStr test1
when (test1 /= goodTest1) exitFailure
putStr test2
when (test2 /= goodTest2) exitFailure
putStr test3
when (test3 /= goodTest3) exitFailure
goodTest1 = unlines $
["WARNING: source was truncated to 80x25; use --allow-oversize for source code of arbitrary dimensions.",
"0 1 2 3 4 5 6 7 ",
"GOOD: , works",
"GOOD: : duplicates",
"GOOD: empty stack pops zero",
"GOOD: 2-2 = 0",
"GOOD: | works",
"GOOD: 0! = 1",
"GOOD: 7! = 0",
"GOOD: 8*0 = 0",
"GOOD: # < jumps into <",
"GOOD: \\ swaps",
"GOOD: 01` = 0",
"GOOD: 10` = 1",
"GOOD: 900pg gets 9",
"GOOD: p modifies space",
"GOOD: wraparound works",
"UNDEF: edge # skips column 80",
"GOOD: Funge-93 spaces",
"The Befunge-93 version of the Mycology test suite is done.",
"Quitting..."]
goodTest2 = unlines $
["warning: getCell out of bounds. wrapping.",
"Get/put wraps",
"Cells are >8 bit",
"Edge jumps work",
"Negative remainders work",
"@ in stringmode works"]
goodTest3 = ""