forked from thanhnguyen-aws/plausible
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBitVecStructureTest.lean
More file actions
58 lines (50 loc) · 1.76 KB
/
Copy pathBitVecStructureTest.lean
File metadata and controls
58 lines (50 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import Plausible.Chamelean.Enumerators
import Plausible.Chamelean.EnumeratorCombinators
import Plausible.Chamelean.DeriveEnum
import Test.DeriveArbitrary.BitVecStructureTest
set_option guard_msgs.diff true
deriving instance Enum for DummyInductive
-- Test that we can successfully synthesize instances of `Arbitrary` & `ArbitrarySized`
/-- info: instEnumSizedDummyInductive -/
#guard_msgs in
#synth EnumSized DummyInductive
/-- info: instEnumOfEnumSized -/
#guard_msgs in
#synth Enum DummyInductive
-- We test the command elaborator frontend in a separate namespace to
-- avoid overlapping typeclass instances for the same type
namespace CommandElaboratorTest
/--
info: Try this enumerator: instance : EnumSized DummyInductive where
enumSized :=
let rec aux_enum (size : Nat) : Enumerator DummyInductive :=
match size with
| Nat.zero =>
EnumeratorCombinators.oneOfWithDefault
(do
let n_0 ← Enum.enum
let a_0 ← Enum.enum
let a_1 ← Enum.enum
return DummyInductive.FromBitVec n_0 a_0 a_1)
[do
let n_0 ← Enum.enum
let a_0 ← Enum.enum
let a_1 ← Enum.enum
return DummyInductive.FromBitVec n_0 a_0 a_1]
| Nat.succ size' =>
EnumeratorCombinators.oneOfWithDefault
(do
let n_0 ← Enum.enum
let a_0 ← Enum.enum
let a_1 ← Enum.enum
return DummyInductive.FromBitVec n_0 a_0 a_1)
[do
let n_0 ← Enum.enum
let a_0 ← Enum.enum
let a_1 ← Enum.enum
return DummyInductive.FromBitVec n_0 a_0 a_1, ]
fun size => aux_enum size
-/
#guard_msgs(info, drop warning) in
#derive_enum DummyInductive
end CommandElaboratorTest