-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TAP.idr
31 lines (24 loc) · 831 Bytes
/
TAP.idr
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
module TAP
import System
import Data.Vect
%default total
%access private
comment : String -> IO ()
comment s = putStrLn ("# " ++ s)
stamp : IO () -> IO ()
stamp rest = do t <- time
comment ("t " ++ (show t))
rest
printResult : String -> Bool -> IO ()
printResult n True = putStrLn ("ok " ++ n)
printResult n False = putStrLn ("not ok " ++ n)
runTests : Nat -> Vect n (Lazy (IO Bool)) -> IO ()
runTests k [] = pure ()
runTests k (x :: xs) = x >>= printResult (show k) >>= \_ => runTests (S k) xs
export
plan : (desc : String) -> Vect n (Lazy (IO Bool)) -> IO ()
plan desc tests {n} = do putStrLn "TAP version 13"
comment desc
putStrLn ("1.." ++ show n)
runTests 1 tests
stamp $ comment "done"