-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathExprTests.fs
47 lines (41 loc) · 1.25 KB
/
ExprTests.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
/// <summary>
/// Utilities and types for working with expressions.
/// </summary>
module Starling.Tests.Core.Expr
open Starling.Utils
open Starling.Core.TypeSystem
open NUnit.Framework
open Starling.Core.Expr
module ExprSimp =
[<Test>]
let ``Expression simplification on trivial conjunctions.`` () =
Assert.AreEqual (
(simp (BAnd [BTrue; BTrue])),
BTrue
)
[<Test>]
let ``Expression de-duplication, conjuction removal.`` () =
Assert.AreEqual (
simp (BAnd [ BEq
(normalIntExpr (IVar "foo"),
normalIntExpr (IVar "bar"));
BEq
(normalIntExpr (IVar "bar"),
normalIntExpr (IVar "foo"))
]),
BEq (normalIntExpr (IVar "foo"),
normalIntExpr (IVar "bar"))
)
[<Test>]
let ``Expression de-duplication, disjunction removal.`` () =
Assert.AreEqual (
simp (BOr [ BEq
(normalIntExpr (IVar "foo"),
normalIntExpr (IVar "bar"));
BEq
(normalIntExpr (IVar "bar"),
normalIntExpr (IVar "foo"))
]),
BEq (normalIntExpr (IVar "foo"),
normalIntExpr (IVar "bar"))
)