mirror of https://github.com/apache/lucene.git
SOLR-13898: Allow inexact double comparison. Close resources.
This commit is contained in:
parent
d1163450b6
commit
66e78ba7c5
|
@ -69,11 +69,20 @@ public class TestSolrCachePerf extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
computeRatio.forEach((type, computeStats) -> {
|
computeRatio.forEach((type, computeStats) -> {
|
||||||
SummaryStatistics getPutStats = getPutRatio.get(type);
|
SummaryStatistics getPutStats = getPutRatio.get(type);
|
||||||
assertTrue("compute ratio (" + computeStats.getMean() + ") should be higher or equal from get/put ("
|
assertGreaterThanOrEqual( "Compute ratio should be higher or equal to get/put ratio", computeStats.getMean(), getPutStats.getMean(), 0.0001);
|
||||||
+ getPutStats.getMean() + ")", computeStats.getMean() >= getPutStats.getMean());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertGreaterThanOrEqual(String message, double greater, double smaller, double delta) {
|
||||||
|
if (greater > smaller) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
if (Math.abs(greater - smaller) > delta) {
|
||||||
|
fail(message + ": " + greater + " >= " + smaller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static final String VALUE = "foo";
|
static final String VALUE = "foo";
|
||||||
|
|
||||||
private void doTestGetPutCompute(Map<String, SummaryStatistics> ratioStats, Map<String, SummaryStatistics> timeStats, int numThreads, boolean useCompute) throws Exception {
|
private void doTestGetPutCompute(Map<String, SummaryStatistics> ratioStats, Map<String, SummaryStatistics> timeStats, int numThreads, boolean useCompute) throws Exception {
|
||||||
|
@ -135,6 +144,7 @@ public class TestSolrCachePerf extends SolrTestCaseJ4 {
|
||||||
perImplRatio.addValue(
|
perImplRatio.addValue(
|
||||||
Double.parseDouble(String.valueOf(metrics.get("CACHE.foo.hitratio"))));
|
Double.parseDouble(String.valueOf(metrics.get("CACHE.foo.hitratio"))));
|
||||||
perImplTime.addValue((double)(stopTime - startTime));
|
perImplTime.addValue((double)(stopTime - startTime));
|
||||||
|
cache.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue