diff options
author | Camil Staps | 2016-01-31 15:48:01 +0100 |
---|---|---|
committer | Camil Staps | 2016-01-31 15:48:01 +0100 |
commit | 15dcafd338f0d4f59f0c1c9313007c8f1a335e07 (patch) | |
tree | 6bf872ff4b26efef4c9bd3472e388d91b4c6f2f3 | |
parent | License, cc=80 (diff) |
Extended testing
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | test.icl | 32 |
2 files changed, 27 insertions, 7 deletions
@@ -48,7 +48,7 @@ $(TEST_SCRIPT): $(TEST_SCRIPT).icl $(NAME).icl $(NAME).dcl $(OBJ) $(TEST_SCRIPT) $(CLM) $(CLMFLAGS) -l $(TEST_SCRIPT).o $(TEST_SCRIPT) -o $(TEST_SCRIPT) run_test: $(TEST_SCRIPT) - ./$(TEST_SCRIPT) -nt + ./$(TEST_SCRIPT) -nt -nr .PHONY: all clean clean_intermediate run_test @@ -25,14 +25,34 @@ module test import StdEnv import CleanC -Start +Start :: *World -> *World +Start w # s = cNewState # s = cInit s -# (r0,s) = test_int s -# (r1,s) = test_string s -# (r2,s) = test_double s -# (r3,s) = test_two_params s -= and [r0,r1,r2,r3] +# (t0,s) = test_int s +# (t1,s) = test_string s +# (t2,s) = test_double s +# (t3,s) = test_two_params s +# tests = [t0,t1,t2,t3] +# passed = and tests +# (io, w) = stdio w +| passed + # io = fwrites "\x1B[32mAll tests passed\n\033[0m" io + # (_, w) = fclose io w + = w +| otherwise + # io = fwrites "\x1B[31mSome tests failed, nrs:\n\033[0m" io + # io = fwrites (failed_list tests +++ "\n") io + # (_, w) = fclose io w + = w +where + failed_list :: [Bool] -> String + failed_list rs = join ", " [i \\ i <- [1..] & r <- rs | not r] + + join :: String [a] -> String | toString a + join d [] = "" + join d [x] = toString x + join d [x:xs] = toString x +++ d +++ join d xs test_int :: *State -> (Bool, *State) test_int s |