mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 09:40:58 +00:00
Merge 8630cc0993 into fa0a952f1e
This commit is contained in:
+2
-5
@@ -108,11 +108,8 @@ class OnlineParserTest {
|
||||
MetricFamily metricFamily1 = metricFamilyMap1.get(metricFamilyName);
|
||||
Set<Double> metricValueSet = metricFamily2.getMetricList().stream().map(MetricFamily.Metric::getValue).collect(Collectors.toSet());
|
||||
metricFamily1.getMetricList().forEach(metric -> {
|
||||
// this is for something different between two algorithms above, and both of them is current on this parsing behavior.
|
||||
if (!(metric.getValue() == Double.POSITIVE_INFINITY || metric.getValue() == Double.NEGATIVE_INFINITY)) {
|
||||
if (!metricValueSet.contains(metric.getValue())) {
|
||||
fail();
|
||||
}
|
||||
if (!metricValueSet.contains(metric.getValue())) {
|
||||
fail();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -153,9 +153,9 @@ public class StrBuffer {
|
||||
*/
|
||||
public static double parseDouble(String s) {
|
||||
if (POSITIVE_INF.equalsIgnoreCase(s)) {
|
||||
return POSITIVE_INF_VALUE;
|
||||
return Double.POSITIVE_INFINITY;
|
||||
} else if (NEGATIVE_INF.equalsIgnoreCase(s)) {
|
||||
return NEGATIVE_INF_VALUE;
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
return Double.parseDouble(s);
|
||||
}
|
||||
|
||||
+4
-4
@@ -91,10 +91,10 @@ class StrBufferTest {
|
||||
assertEquals(123.45, buffer.toDouble());
|
||||
|
||||
buffer = new StrBuffer("+inf");
|
||||
assertEquals(POSITIVE_INF_VALUE, buffer.toDouble());
|
||||
assertEquals(Double.POSITIVE_INFINITY, buffer.toDouble());
|
||||
|
||||
buffer = new StrBuffer("-inf");
|
||||
assertEquals(NEGATIVE_INF_VALUE, buffer.toDouble());
|
||||
assertEquals(Double.NEGATIVE_INFINITY, buffer.toDouble());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,8 +144,8 @@ class StrBufferTest {
|
||||
void testParseDouble() {
|
||||
|
||||
assertEquals(123.45, StrBuffer.parseDouble("123.45"));
|
||||
assertEquals(POSITIVE_INF_VALUE, StrBuffer.parseDouble("+inf"));
|
||||
assertEquals(NEGATIVE_INF_VALUE, StrBuffer.parseDouble("-inf"));
|
||||
assertEquals(Double.POSITIVE_INFINITY, StrBuffer.parseDouble("+inf"));
|
||||
assertEquals(Double.NEGATIVE_INFINITY, StrBuffer.parseDouble("-inf"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user