summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-11-05 09:22:51 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-11-05 11:07:38 +0000
commitaddec679db06203eb4cea71d8f98d38fec9f772c (patch)
treef1458a3642d957ebd33928a6bb65a4a596a08b21 /qadevOOo
parent94268513eeded3952972d7efe0a9bc689605421b (diff)
coverity#1326879 FE: Test for floating point equality
and coverity#1326880 FE: Test for floating point equality coverity#1326881 FE: Test for floating point equality coverity#1326882 FE: Test for floating point equality coverity#1326883 FE: Test for floating point equality coverity#1326884 FE: Test for floating point equality coverity#1326885 FE: Test for floating point equality coverity#1326886 FE: Test for floating point equality coverity#1326887 FE: Test for floating point equality coverity#1326888 FE: Test for floating point equality Change-Id: I04a00035d541ea7a253a37d2a87c4dc407228346
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/tests/java/ifc/awt/_XCurrencyField.java39
-rw-r--r--qadevOOo/tests/java/ifc/awt/_XNumericField.java32
2 files changed, 41 insertions, 30 deletions
diff --git a/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java b/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java
index 3b03b866fb8e..beb74889d48f 100644
--- a/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java
@@ -21,6 +21,7 @@ package ifc.awt;
import lib.MultiMethodTest;
import com.sun.star.awt.XCurrencyField;
+import util.utils;
/**
* Testing <code>com.sun.star.awt.XCurrencyField</code>
@@ -69,9 +70,12 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setValue() {
requiredMethod("getValue()");
- oObj.setValue(val + 1.1);
+ double value = val + 1.1;
+ oObj.setValue(value);
+ double ret = oObj.getValue();
+ boolean result = utils.approxEqual(ret, value);
- tRes.tested("setValue()", oObj.getValue() == val + 1.1);
+ tRes.tested("setValue()", result);
}
/**
@@ -95,9 +99,12 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setMin() {
requiredMethod("getMin()");
- oObj.setMin(min + 1.1);
+ double value = min + 1.1;
+ oObj.setMin(value);
+ double ret = oObj.getMin();
+ boolean result = utils.approxEqual(ret, value);
- tRes.tested("setMin()", oObj.getMin() == min + 1.1);
+ tRes.tested("setMin()", result);
}
/**
@@ -123,9 +130,10 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setMax() {
requiredMethod("getMax()");
- boolean result = true;
- oObj.setMax(max + 1.1);
- result = oObj.getMax() == max + 1.1;
+ double value = max + 1.1;
+ oObj.setMax(value);
+ double ret = oObj.getMax();
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setMax()", result);
}
@@ -153,11 +161,10 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setFirst() {
requiredMethod("getFirst()");
- boolean result = true;
double value = first + 1.1;
oObj.setFirst(value);
double ret = oObj.getFirst();
- result = ret == value;
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setFirst()", result);
}
@@ -185,11 +192,10 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setLast() {
requiredMethod("getLast()");
- boolean result = true;
- oObj.setLast(last + 1.1);
+ double value = last + 1.1;
+ oObj.setLast(value);
double ret = oObj.getLast();
-
- result = ret == last + 1.1;
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setLast()", result);
}
@@ -217,9 +223,10 @@ public class _XCurrencyField extends MultiMethodTest {
public void _setSpinSize() {
requiredMethod("getSpinSize()");
- boolean result = true;
- oObj.setSpinSize(spin + 1.1);
- result = oObj.getSpinSize() == spin + 1.1;
+ double value = spin + 1.1;
+ oObj.setSpinSize(value);
+ double ret = oObj.getSpinSize();
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setSpinSize()", result);
}
diff --git a/qadevOOo/tests/java/ifc/awt/_XNumericField.java b/qadevOOo/tests/java/ifc/awt/_XNumericField.java
index 3337f186e229..54c25fac8611 100644
--- a/qadevOOo/tests/java/ifc/awt/_XNumericField.java
+++ b/qadevOOo/tests/java/ifc/awt/_XNumericField.java
@@ -22,6 +22,7 @@ package ifc.awt;
import lib.MultiMethodTest;
import com.sun.star.awt.XNumericField;
+import util.utils;
/**
* Testing <code>com.sun.star.awt.XNumericField</code>
@@ -96,9 +97,12 @@ public class _XNumericField extends MultiMethodTest {
public void _setMin() {
requiredMethod("getMin()") ;
- oObj.setMin(min + 1.1) ;
+ double value = min + 1.1;
+ oObj.setMin(value);
+ double ret = oObj.getMin();
+ boolean result = utils.approxEqual(ret, value);
- tRes.tested("setMin()", oObj.getMin() == min + 1.1) ;
+ tRes.tested("setMin()", result);
}
/**
@@ -124,9 +128,10 @@ public class _XNumericField extends MultiMethodTest {
public void _setMax() {
requiredMethod("getMax()") ;
- boolean result = true ;
- oObj.setMax(max + 1.1) ;
- result = oObj.getMax() == max + 1.1 ;
+ double value = max + 1.1;
+ oObj.setMax(value);
+ double ret = oObj.getMax();
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setMax()", result) ;
}
@@ -154,10 +159,10 @@ public class _XNumericField extends MultiMethodTest {
public void _setFirst() {
requiredMethod("getFirst()") ;
- boolean result = true ;
- oObj.setFirst(first + 1.1) ;
- double ret = oObj.getFirst() ;
- result = ret == first + 1.1 ;
+ double value = first + 1.1;
+ oObj.setFirst(value);
+ double ret = oObj.getFirst();
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setFirst()", result) ;
}
@@ -185,11 +190,10 @@ public class _XNumericField extends MultiMethodTest {
public void _setLast() {
requiredMethod("getLast()") ;
- boolean result = true ;
- oObj.setLast(last + 1.1) ;
- double ret = oObj.getLast() ;
-
- result = ret == last + 1.1 ;
+ double value = last + 1.1;
+ oObj.setLast(value);
+ double ret = oObj.getLast();
+ boolean result = utils.approxEqual(ret, value);
tRes.tested("setLast()", result) ;
}