module Test.TLT.Results where
data TestFail = Asserted String
| Erred String
formatFail :: TestFail -> String
formatFail :: TestFail -> String
formatFail (Asserted String
s) = String
s
formatFail (Erred String
s) = String
"Assertion raised exception: " forall a. [a] -> [a] -> [a]
++ String
s
data TestResult = Test String [TestFail]
| Group String Int Int [TestResult]
failCount :: TestResult -> Int
failCount :: TestResult -> Int
failCount (Test String
_ []) = Int
0
failCount (Test String
_ [TestFail]
_) = Int
1
failCount (Group String
_ Int
_ Int
n [TestResult]
_) = Int
n
testCount :: TestResult -> Int
testCount :: TestResult -> Int
testCount (Test String
_ [TestFail]
_) = Int
1
testCount (Group String
_ Int
n Int
_ [TestResult]
_) = Int
n
totalFailCount :: [TestResult] -> Int
totalFailCount :: [TestResult] -> Int
totalFailCount = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr forall a. Num a => a -> a -> a
(+) Int
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map TestResult -> Int
failCount
totalTestCount :: [TestResult] -> Int
totalTestCount :: [TestResult] -> Int
totalTestCount = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr forall a. Num a => a -> a -> a
(+) Int
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map TestResult -> Int
testCount