Skip to content

Commit 06f4b40

Browse files
committed
[RED] Test.Kore.Internal.Key
1 parent 0b6711d commit 06f4b40

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

kore/kore.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22

3-
-- This file has been generated from package.yaml by hpack version 0.34.1.
3+
-- This file has been generated from package.yaml by hpack version 0.34.2.
44
--
55
-- see: https://github.com/sol/hpack
66

@@ -954,6 +954,7 @@ test-suite kore-test
954954
Test.Kore.IndexedModule.SortGraph
955955
Test.Kore.Internal.ApplicationSorts
956956
Test.Kore.Internal.Condition
957+
Test.Kore.Internal.Key
957958
Test.Kore.Internal.MultiAnd
958959
Test.Kore.Internal.OrCondition
959960
Test.Kore.Internal.OrPattern

kore/test/Test/Kore/Internal/Key.hs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
module Test.Kore.Internal.Key
2+
( test_retractKey
3+
) where
4+
5+
import Prelude.Kore
6+
7+
import Test.Tasty
8+
9+
import Kore.Internal.TermLike
10+
( Concrete
11+
, DomainValue (..)
12+
, TermLike
13+
, mkDomainValue
14+
, mkStringLiteral
15+
, retractKey
16+
)
17+
18+
import Test.Kore.Builtin.Definition
19+
( mkBool
20+
, mkBytes
21+
, mkInt
22+
, mkList
23+
, mkMap
24+
, mkSet_
25+
, mkString
26+
, userTokenSort
27+
)
28+
import Test.Tasty.HUnit.Ext
29+
30+
test_retractKey :: [TestTree]
31+
test_retractKey =
32+
[ test "Int" (mkInt 1)
33+
, test "Bool" (mkBool True)
34+
, test "String" (mkString "string")
35+
, test "Bytes" (mkBytes [0x00, 0xFF])
36+
, test "Set" (mkSet_ [mkInt 1])
37+
, test "Map" (mkMap [(mkInt 1, mkString "one")])
38+
, test "List" (mkList [mkInt 1, mkInt 2])
39+
, test "token"
40+
(mkDomainValue DomainValue
41+
{ domainValueSort = userTokenSort
42+
, domainValueChild = mkStringLiteral "token"
43+
}
44+
)
45+
]
46+
where
47+
test :: HasCallStack => TestName -> TermLike Concrete -> TestTree
48+
test testName term =
49+
testCase testName $ do
50+
let actual = retractKey term
51+
assertBool "expected key" (isJust actual)

0 commit comments

Comments
 (0)