Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/hspec/MapSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ myMap2 = ext (Var :: (Var "w")) (2::Int) $ ext (Var :: (Var "z")) (4::Int) empty

spec :: Spec
spec = do
describe "Map tests" $
it "Map tests" $ do
describe "Map tests" $ do
it "foo map lookups" $ do
(lookp (Var @"x") Example.foo) `shouldBe` (2 :: Int)
(lookp (Var @"w") Example.foo) `shouldBe` (5 :: Int)
(lookp (Var @"z") Example.foo) `shouldBe` True
(mapLength Example.foo) `shouldBe` 3
it "bar map lookups" $ do
(lookp (Var @"y") Example.bar) `shouldBe` (3 :: Int)
(lookp (Var @"w") Example.bar) `shouldBe` (1 :: Int)
(mapLength Example.bar) `shouldBe` 2
it "foobar union combines values correctly" $ do
(lookp (Var @"w") Example.foobar) `shouldBe` (6 :: Int) -- 5 + 1 combined
(lookp (Var @"x") Example.foobar) `shouldBe` (2 :: Int)
(lookp (Var @"y") Example.foobar) `shouldBe` (3 :: Int)
(lookp (Var @"z") Example.foobar) `shouldBe` True
(mapLength Example.foobar) `shouldBe` 4
7 changes: 7 additions & 0 deletions tests/hspec/SetSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module SetSpec where

import Test.Hspec
import Data.Type.Set
import qualified ExampleSet
import ExampleSet2

spec :: Spec
Expand All @@ -20,3 +21,9 @@ spec = do
barHasNat1 `shouldBe` False
it "Union of large sets should run in reasonable time" $ do
(r0_9 `union` r10_19) `shouldBe` (r0_9 `append` r10_19)
describe "Natural set example from README" $ do
it "foo, bar, and foobar unions compile successfully" $ do
-- These are mainly type-level tests - if they compile, they work
show ExampleSet.foo `shouldSatisfy` (not . null)
show ExampleSet.bar `shouldSatisfy` (not . null)
show ExampleSet.foobar `shouldSatisfy` (not . null)
Loading