ConstantDoubleComparisons: add gt/lt comparisons

This commit is contained in:
Tagir Valeev
2018-11-15 15:26:39 +07:00
parent 1f2629b25b
commit 8b8179eec7
@@ -21,4 +21,22 @@ class Foo {
Double posz = +0.0, negz = -0.0;
System.out.println(<warning descr="Result of 'posz.equals(negz)' is always 'false'">posz.equals(negz)</warning>);
}
void gtLt() {
double x = 5.0;
double y = 6.0;
if (<warning descr="Condition 'x > y' is always 'false'">x > y</warning>) {}
if (<warning descr="Condition 'x >= y' is always 'false'">x >= y</warning>) {}
if (<warning descr="Condition 'x > 4' is always 'true'">x > 4</warning>) {}
if (<warning descr="Condition 'y < 3' is always 'false'">y < 3</warning>) {}
}
void gtLtBoxed() {
Double x = 5.0;
Double y = 6.0;
if (<warning descr="Condition 'x > y' is always 'false'">x > y</warning>) {}
if (<warning descr="Condition 'x >= y' is always 'false'">x >= y</warning>) {}
if (<warning descr="Condition 'x > 4' is always 'true'">x > 4</warning>) {}
if (<warning descr="Condition 'y < 3' is always 'false'">y < 3</warning>) {}
}
}