summaryrefslogtreecommitdiff
path: root/src/test/java/sevenUnitsGUI/RoundingTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/sevenUnitsGUI/RoundingTest.java')
-rw-r--r--src/test/java/sevenUnitsGUI/RoundingTest.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/test/java/sevenUnitsGUI/RoundingTest.java b/src/test/java/sevenUnitsGUI/RoundingTest.java
index ca1a272..f749f85 100644
--- a/src/test/java/sevenUnitsGUI/RoundingTest.java
+++ b/src/test/java/sevenUnitsGUI/RoundingTest.java
@@ -49,13 +49,13 @@ class RoundingTest {
private static final FixedDecimals ZERO_DECIMALS = fixedDecimals(0);
private static final FixedDecimals TWO_DECIMALS = fixedDecimals(2);
private static final FixedDecimals SIX_DECIMALS = fixedDecimals(6);
-
+
private static final FixedPrecision ONE_SIG_FIG = fixedPrecision(1);
private static final FixedPrecision THREE_SIG_FIGS = fixedPrecision(3);
private static final FixedPrecision TWELVE_SIG_FIGS = fixedPrecision(12);
-
+
private static final UncertaintyBased UNCERTAINTY_BASED = uncertaintyBased();
-
+
// numbers to test rounding with
private static final UncertainDouble INPUT1 = UncertainDouble.of(12.3456789,
0.0);
@@ -65,7 +65,7 @@ class RoundingTest {
0.0);
private static final UncertainDouble INPUT4 = UncertainDouble.of(0.00001234,
0.000001);
-
+
/**
* @return arguments for
* {@link #testFixedDecimalRounding(UncertainDouble, String, String, String)}
@@ -79,7 +79,7 @@ class RoundingTest {
Arguments.of(INPUT3, "12345432", "12345432.10", "12345432.100000"),
Arguments.of(INPUT4, "0", "0.00", "0.000012"));
}
-
+
/**
* @return arguments for
* {@link #testFixedPrecisionRounding(UncertainDouble, String, String, String)}
@@ -93,7 +93,7 @@ class RoundingTest {
Arguments.of(INPUT3, "1E+7", "1.23E+7", "12345432.1000"),
Arguments.of(INPUT4, "0.00001", "0.0000123", "0.0000123400000000"));
}
-
+
/**
* @return arguments for
* {@link #testUncertaintyRounding(UncertainDouble, String)}
@@ -107,7 +107,7 @@ class RoundingTest {
Arguments.of(INPUT3, "1.23454321E7"),
Arguments.of(INPUT4, "0.0000123"));
}
-
+
/**
* Test for {@link FixedDecimals#decimalPlaces()} and
* {@link FixedPrecision#significantFigures()}.
@@ -124,7 +124,7 @@ class RoundingTest {
"TWO_DECIMALS has " + TWO_DECIMALS.decimalPlaces() + " decimals");
assertEquals(6, SIX_DECIMALS.decimalPlaces(),
"SIX_DECIMALS has " + SIX_DECIMALS.decimalPlaces() + " decimals");
-
+
// ensure # of sig figs can be accessed
assertEquals(1, ONE_SIG_FIG.significantFigures(), "ONE_SIG_FIG has "
+ ONE_SIG_FIG.significantFigures() + " significant figures");
@@ -134,7 +134,7 @@ class RoundingTest {
"TWELVE_SIG_FIGS has " + TWELVE_SIG_FIGS.significantFigures()
+ " significant figures");
}
-
+
/**
* Tests that the rounding methods' equals() methods work.
*
@@ -150,14 +150,14 @@ class RoundingTest {
"TWO_DECIMALS == SIX_DECIMALS");
assertTrue(Objects.equals(fixedDecimals(0), fixedDecimals(0)),
"FixedDecimals.equals() depends on something other than decimal places.");
-
+
assertTrue(ONE_SIG_FIG.equals(ONE_SIG_FIG),
"ONE_SIG_FIG does not equal itself");
assertFalse(THREE_SIG_FIGS.equals(TWELVE_SIG_FIGS),
"THREE_SIG_FIGS == TWELVE_SIG_FIGS");
assertTrue(Objects.equals(fixedPrecision(1), fixedPrecision(1)),
"FixedPrecision.equals() depends on something other than significant figures.");
-
+
// test that FixedDecimals is never equal to FixedPrecision
// this unlikely argument is the test - the equals should return false!
@SuppressWarnings("unlikely-arg-type")
@@ -165,7 +165,7 @@ class RoundingTest {
fixedPrecision(4));
assertFalse(differentRulesEqual, "fixedDecimals(4) == fixedPrecision(4)");
}
-
+
/**
* Ensures that fixed decimal rounding works as expected
*
@@ -192,7 +192,7 @@ class RoundingTest {
"TWO_DECIMALS rounded " + input + " as " + SIX_DECIMALS.apply(input)
+ " (should be " + sixDecimalString + ")");
}
-
+
/**
* Ensures that fixed precision rounding works as expected
*
@@ -221,7 +221,7 @@ class RoundingTest {
+ TWELVE_SIG_FIGS.apply(input) + " (should be "
+ twelveSigFigString + ")");
}
-
+
/**
* Tests that {@link StandardDisplayRules#getStandardRule} gets rounding
* rules as intended.
@@ -236,11 +236,11 @@ class RoundingTest {
getStandardRule("Round to 3 significant figures"));
assertEquals(UNCERTAINTY_BASED,
getStandardRule("Uncertainty-Based Rounding"));
-
+
assertThrows(IllegalArgumentException.class,
() -> getStandardRule("Not a rounding rule"));
}
-
+
/**
* Tests that the rounding methods' equals() methods work.
*
@@ -253,7 +253,7 @@ class RoundingTest {
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 +267,7 @@ class RoundingTest {
assertEquals("Round to 3 significant figures", THREE_SIG_FIGS.toString());
assertEquals("Uncertainty-Based Rounding", UNCERTAINTY_BASED.toString());
}
-
+
/**
* Tests that Uncertainty Rounding works as expected
*