-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tests.fs
64 lines (49 loc) · 1.21 KB
/
Tests.fs
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
module Tests
open Xunit
open MiniSat
let private isSatisfiable =
findSolutions
>> Seq.isEmpty
>> not
[<Fact>]
let ``Determines satisfiability correctly`` () =
let cases =
[
(Conj Set.empty, true)
(Neg (Atom "a"), true)
(Disj (set [ Atom "a"; Neg (Atom "a") ]), true)
(Conj (set [ Atom "a"; Neg (Atom "a") ]), false)
(
Disj
(
set
[
Conj (set [ Atom "a"; Atom "b" ])
Atom "c"
]
),
true
)
(Disj (set [ Atom "a"; Atom "b"; Atom "c"; Atom "d"; Neg (Atom "a") ]), true)
(Conj (set [ Atom "a"; Atom "b"; Atom "c"; Atom "d"; Neg (Atom "a") ]), false)
(Conj (set [ Atom "a"; Conj Set.empty ]), true)
(
Conj
(
set
[
Atom "a";
Atom "b";
Disj (set [ Neg (Atom "c"); (Atom "b") ])
Atom "c";
Disj (set [ (Atom "a"); Neg (Atom "b") ]);
Atom "d";
]
),
true
)
]
for (input, expected) in cases do
printfn "%O" input
Assert.Equal(expected, isSatisfiable input)
()