forked from goblint/analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaindomaintest.ml
134 lines (116 loc) · 3.4 KB
/
maindomaintest.ml
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
(* open! Defaults (* Enums / ... need initialized conf *) *)
module type FiniteSetElems =
sig
type t
val elems: t list
end
module FiniteSet (E:Printable.S) (Elems:FiniteSetElems with type t = E.t) =
struct
module E =
struct
include E
let arbitrary () = QCheck.oneofl Elems.elems
end
include SetDomain.Make (E)
let top () = of_list Elems.elems
let is_top x = equal x (top ())
end
module PrintableChar =
struct
include Printable.Std
type t = char [@@deriving eq, ord, hash, to_yojson]
let name () = "char"
let show x = String.make 1 x
module P =
struct
type nonrec t = t
let show = show
end
include Printable.SimpleShow (P)
end
module ArbitraryLattice = FiniteSet (PrintableChar) (
struct
type t = char
let elems = ['a'; 'b'; 'c'; 'd']
end
)
module HoareArbitrary = HoareDomain.Set_LiftTop (ArbitraryLattice) (struct let topname = "Top" end)
module HoareArbitrary_NoTop = HoareDomain.Set (ArbitraryLattice)
let domains: (module Lattice.S) list = [
(* (module IntDomainProperties.IntegerSet); (* TODO: top properties error *) *)
(module IntDomain.Lifted); (* not abstraction of IntegerSet *)
(* TODO: move to intDomains if passing *)
(module IntDomain.Booleans);
(* TODO: fix *)
(* (module IntDomain.Enums); *)
(* (module IntDomain.IntDomTuple); *)
(module ArbitraryLattice);
(module HoareArbitrary);
(module HoareArbitrary_NoTop);
(module HoareDomain.MapBot (ArbitraryLattice) (HoareArbitrary));
(module HoareDomain.MapBot (ArbitraryLattice) (HoareArbitrary_NoTop));
]
let nonAssocDomains: (module Lattice.S) list = []
let intDomains: (module IntDomainProperties.S) list = [
(module IntDomain.Interval);
(module IntDomain.Enums);
(module IntDomain.Congruence);
(* (module IntDomain.Flattened); *)
(* (module IntDomain.Interval32); *)
(* (module IntDomain.Booleans); *)
(* (module IntDomain.IntDomTuple); *)
]
let nonAssocIntDomains: (module IntDomainProperties.S) list = [
(module IntDomain.DefExc);
]
(* TODO: make arbitrary ikind part of domain test for better efficiency *)
let ikinds: Cil.ikind list = [
IChar;
ISChar;
IUChar;
IBool;
IInt;
IUInt;
IShort;
IUShort;
ILong;
IULong;
ILongLong;
IULongLong;
]
let testsuite =
domains
|> List.concat_map (fun d ->
let module D = (val d: Lattice.S) in
let module DP = DomainProperties.All (D) in
DP.tests
)
let nonAssocTestsuite =
nonAssocDomains
|> List.concat_map (fun d ->
let module D = (val d: Lattice.S) in
let module DP = DomainProperties.AllNonAssoc (D) in
DP.tests
)
let old_intdomains intDomains =
BatList.cartesian_product intDomains ikinds
|> List.map (fun (d, ik) ->
let module D = (val d: IntDomainProperties.S) in
let module Ikind = struct let ikind () = ik end in
(module IntDomainProperties.WithIkind (D) (Ikind): IntDomainProperties.OldSWithIkind)
)
let intTestsuite =
old_intdomains intDomains
|> List.concat_map (fun d ->
let module D = (val d: IntDomainProperties.OldSWithIkind) in
let module DP = IntDomainProperties.All (D) in
DP.tests
)
let nonAssocIntTestsuite =
old_intdomains nonAssocIntDomains
|> List.concat_map (fun d ->
let module D = (val d: IntDomainProperties.OldSWithIkind) in
let module DP = IntDomainProperties.AllNonAssoc (D) in
DP.tests
)
let all_testsuite = testsuite @ nonAssocTestsuite @ intTestsuite @ nonAssocIntTestsuite