Tests: Fix edge case in InternalSimpleValueTests (#26084)

When value is NaN, the mutate function might return a new instance that is
equal to the original one.

* Add same fix for InternalDerivativeTests
This commit is contained in:
Christoph Büscher 2017-08-07 18:30:18 +02:00 committed by GitHub
parent 99d79d5a0f
commit 729e09ed6e
2 changed files with 10 additions and 2 deletions

View File

@ -81,7 +81,11 @@ public class InternalSimpleValueTests extends InternalAggregationTestCase<Intern
name += randomAlphaOfLength(5);
break;
case 1:
value += between(1, 100);
if (Double.isFinite(value)) {
value += between(1, 100);
} else {
value = randomDoubleBetween(0, 100000, true);
}
break;
case 2:
if (metaData == null) {

View File

@ -84,7 +84,11 @@ public class InternalDerivativeTests extends InternalAggregationTestCase<Interna
name += randomAlphaOfLength(5);
break;
case 1:
value += between(1, 100);
if (Double.isFinite(value)) {
value += between(1, 100);
} else {
value = randomDoubleBetween(0, 100000, true);
}
break;
case 2:
normalizationFactor += between(1, 100);