Skip to content

Commit 1f149a3

Browse files
committed
Add empty set unit tests to all matching kinds
1 parent 3e2e8c5 commit 1f149a3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

booster/unit-tests/Test/Booster/Pattern/MatchEval.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import Booster.Pattern.Base
1717
import Booster.Pattern.Match
1818
import Booster.Syntax.Json.Internalise (trm)
1919
import Test.Booster.Fixture
20+
import Test.Booster.Pattern.InternalCollections
2021

2122
test_match_eval :: TestTree
2223
test_match_eval =
@@ -28,6 +29,7 @@ test_match_eval =
2829
, andTerms
2930
, composite
3031
, kmapTerms
32+
, internalSets
3133
]
3234

3335
symbols :: TestTree
@@ -293,6 +295,19 @@ cornerCases =
293295
let v = var "X" someSort
294296
in errors "identical variables" v v
295297

298+
internalSets :: TestTree
299+
internalSets =
300+
testGroup
301+
"Internal sets"
302+
[ test
303+
"Can match an empty set with itself"
304+
emptySet
305+
emptySet
306+
(success [])
307+
]
308+
309+
----------------------------------------
310+
296311
test :: String -> Term -> Term -> MatchResult -> TestTree
297312
test name pat subj expected =
298313
testCase name $ matchTerms Eval testDefinition pat subj @?= expected

booster/unit-tests/Test/Booster/Pattern/MatchImplies.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test_match_implies =
3232
, sorts
3333
, injections
3434
, internalLists
35+
, internalSets
3536
, internalMaps
3637
]
3738

@@ -377,6 +378,17 @@ internalLists =
377378

378379
klist = KList testKListDef
379380

381+
internalSets :: TestTree
382+
internalSets =
383+
testGroup
384+
"Internal sets"
385+
[ test
386+
"Can match an empty set with itself"
387+
emptySet
388+
emptySet
389+
(success [])
390+
]
391+
380392
internalMaps :: TestTree
381393
internalMaps =
382394
testGroup

0 commit comments

Comments
 (0)