lisp-interpreter/test/Main.hs
2025-03-22 00:36:36 -05:00

33 lines
740 B
Haskell

module Main (main) where
import System.Exit (exitFailure, exitSuccess)
import Control.Monad
import Test.HUnit
import Lib
test1 :: Test
test1 = TestCase (assertEqual "2==2" (2.0 :: Double) (2 :: Double))
tests :: Test
tests = TestList [
TestLabel "test 1" test1
]
main :: IO ()
main = do
when (lexStr "'('a' -1.01e12 \r \"\\uabcdasdf\\b\\f\\r\\n\\t\\\\\\/\" )\"asdf"
/= [
Lib.TokQuote,
Lib.TokLPar,
Lib.TokCharacter 'a',
Lib.TokNumber (-1.01e12),
Lib.TokStr "\43981asdf\b\f\r\n\t\\/",
Lib.TokRPar,
Lib.TokErr "End of file reached before matching \""
])
exitFailure
c <- runTestTT tests
putStrLn (showCounts c)
exitSuccess