gsmiller commented on code in PR #1013: URL: https://github.com/apache/lucene/pull/1013#discussion_r924992010
########## lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java: ########## @@ -254,14 +254,38 @@ protected void assertFloatValuesEquals(FacetResult a, FacetResult b) { assertEquals(a.dim, b.dim); Review Comment: I see. OK. Given this, it'd be nice if we renamed it something a little more descriptive of what it's doing (essentially the same thing as the new test helper you're adding, but enforcing ordering). But since this has `protected` visibility, it's possible some other user code is leveraging it, so let's leave it alone for now. Thanks for clarifying! ########## lucene/facet/src/test/org/apache/lucene/facet/FacetTestCase.java: ########## @@ -254,14 +254,38 @@ protected void assertFloatValuesEquals(FacetResult a, FacetResult b) { assertEquals(a.dim, b.dim); assertTrue(Arrays.equals(a.path, b.path)); assertEquals(a.childCount, b.childCount); - assertEquals(a.value.floatValue(), b.value.floatValue(), a.value.floatValue() / 1e5); + assertNumericValuesEquals(a.value, b.value); assertEquals(a.labelValues.length, b.labelValues.length); for (int i = 0; i < a.labelValues.length; i++) { assertEquals(a.labelValues[i].label, b.labelValues[i].label); - assertEquals( - a.labelValues[i].value.floatValue(), - b.labelValues[i].value.floatValue(), - a.labelValues[i].value.floatValue() / 1e5); + assertNumericValuesEquals(a.labelValues[i].value, b.labelValues[i].value); } } + + protected void assertNumericValuesEquals(Number a, Number b) { + assertTrue(a.getClass().isInstance(b)); + if (a instanceof Float) { + assertEquals(a.floatValue(), b.floatValue(), a.floatValue() / 1e5); + } else if (a instanceof Double) { + assertEquals(a.doubleValue(), b.doubleValue(), a.doubleValue() / 1e5); + } else { + assertEquals(a, b); Review Comment: Ah yes. You're right. OK, thanks. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org