Skip to content

Commit 2eca33d

Browse files
committed
Add Tests
1 parent 25b71a6 commit 2eca33d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

liquidjava-verifier/src/test/java/liquidjava/rj_language/opt/VCArithmeticSimplificationTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ void simplifiesOnlyFirstArithmeticIdentity() {
9696
chain(expect("x + 1 > 0", "x + 0 + 1 > 0")));
9797
}
9898

99+
@Test
100+
void simplifiesTernaryExpressionsInConditionThenElseOrder() {
101+
assertSimplificationSteps(VCArithmeticSimplification::apply, vc("(flag + 0 > 0 ? x + 0 : y + 0) > 0"),
102+
chain(expect("(flag > 0 ? x + 0 : y + 0) > 0", "(flag + 0 > 0 ? x + 0 : y + 0) > 0")),
103+
chain(expect("(flag > 0 ? x : y + 0) > 0", "(flag > 0 ? x + 0 : y + 0) > 0")),
104+
chain(expect("(flag > 0 ? x : y) > 0", "(flag > 0 ? x : y + 0) > 0")));
105+
}
106+
107+
@Test
108+
void simplifiesGroupedExpressionsAndLeavesUnchangedGroupsAlone() {
109+
assertSimplificationSteps(VCArithmeticSimplification::apply, vc("(x + 0) * y > 0"),
110+
chain(expect("x * y > 0", "(x + 0) * y > 0")));
111+
assertSimplificationSteps(VCArithmeticSimplification::apply, vc("(x) > 0"), chain(expect("x > 0", "x > 0")));
112+
}
113+
99114
@Test
100115
void recordsOriginWhenSimplifyingLaterImplication() {
101116
VCImplication implication = vc("x > 0", "y + 0 > x");

0 commit comments

Comments
 (0)