From 6274c1cda8248f93075d99bd5ea46922fbec7207 Mon Sep 17 00:00:00 2001 From: Adrien Hopkins Date: Sun, 17 Jul 2022 14:18:00 -0500 Subject: Added another rounding rule test --- src/test/java/sevenUnitsGUI/RoundingTest.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/test/java/sevenUnitsGUI/RoundingTest.java b/src/test/java/sevenUnitsGUI/RoundingTest.java index ddf9cf3..ca1a272 100644 --- a/src/test/java/sevenUnitsGUI/RoundingTest.java +++ b/src/test/java/sevenUnitsGUI/RoundingTest.java @@ -241,6 +241,19 @@ class RoundingTest { () -> getStandardRule("Not a rounding rule")); } + /** + * Tests that the rounding methods' equals() methods work. + * + * @since v0.4.0 + * @since 2022-07-17 + */ + @Test + void testHashCode() { + assertEquals(ZERO_DECIMALS.hashCode(), ZERO_DECIMALS.hashCode()); + assertEquals(ONE_SIG_FIG.hashCode(), ONE_SIG_FIG.hashCode()); + assertEquals(UNCERTAINTY_BASED.hashCode(), UNCERTAINTY_BASED.hashCode()); + } + /** * Tests that the {@code toString()} methods of the three rounding rule * classes work correctly. @@ -267,7 +280,7 @@ class RoundingTest { @MethodSource("uncertaintyRoundingExamples") void testUncertaintyRounding(UncertainDouble input, String output) { assertEquals(output, UNCERTAINTY_BASED.apply(input), - String.format( + () -> String.format( "Uncertainty Rounding rounded %s as %s (should be %s)", input, UNCERTAINTY_BASED.apply(input), output)); } -- cgit v1.2.3