{-# LANGUAGE OverloadedStrings #-} module Main where import Test.Hspec import Graphics.Layout.Arithmetic import Data.CSS.Syntax.Tokens (tokenize, Token(..)) import Debug.Trace (traceShowId) main :: IO () main = hspec spec spec :: Spec spec = do describe "canary" $ do it "test framework works" $ do True `shouldBe` True describe "calc()" $ do it "Can perform basic arithmatic" $ do runMath "42" `shouldBe` 42 runMath "6 * 9" `shouldBe` 54 -- runMath "6 * 9 - 42" `shouldBe` 12 -- runMath "6 * (9 - 42)" `shouldBe` -198 -- runMath "6 * calc(9 - 42)" `shouldBe` -198 -- runMath "6 * abs(9 - 42)" `shouldBe` 198 runMath = flip evalCalc [] . mapCalc fst . flip parseCalc [] . filter (/= Whitespace) . tokenize