I am building a scheme interpreter for my second haskell project. The project has come to a decent stage and I’m currently writing tests using tasty
and tasty-hunit
. I have never written tests before so I would like to get others opinions on whether I’m testing the right things. Please take a look at my tests: haskeme/test/Spec.hs
As of now, I have written tests for arithmetic operations and list operations such as car, cdr, cons etc. Here’s a code snippet for cdr
:
{- (cdr (1 2 3)) => (2 3) (cdr (a b . c)) => (b . c) (cdr (a . c) => c -} cdrT :: TestTree cdrT = testCase "second element from pair" $ do printVal (cdr [List [Number 1, Number 2, Number 3]]) @?= "(2 3)" printVal (cdr [DottedList [Atom "a", Atom "b"] (Atom "c")]) @?= "(b . c)" printVal (cdr [DottedList [Atom "a"] (Atom "c")]) @?= "c"
Any kind of suggestions/advice are welcome. Thanks in advance 🙂