Skip to content

Commit 7b214a2

Browse files
committed
C++: Add division test
1 parent 232c147 commit 7b214a2

File tree

1 file changed

+13
-0
lines changed
  • cpp/ql/test/library-tests/ir/range-analysis

1 file changed

+13
-0
lines changed

cpp/ql/test/library-tests/ir/range-analysis/test.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,16 @@ void test_sub(int x, int y, int n) {
117117
}
118118
}
119119
}
120+
121+
void test_div(int x) {
122+
if (3 <= x && x <= 7) {
123+
range(x / 2); // $ SPURIOUS: range=>=1.5 SPURIOUS: range=<=3.5
124+
range(x / 3); // $ range=>=1 SPURIOUS: range=<=2.333333
125+
range(x >> 2); // $ SPURIOUS: range=>=0.75 SPURIOUS: range=<=1.75
126+
}
127+
if (2 <= x && x <= 8) {
128+
range(x / 2); // $ range=>=1 range=<=4
129+
range(x / 3); // $ SPURIOUS: range=>=0.666667 SPURIOUS: range=<=2.666667
130+
range(x >> 2); // $ SPURIOUS: range=>=0.5 range=<=2
131+
}
132+
}

0 commit comments

Comments
 (0)