Skip to content

Commit

Permalink
143: Add constant ONE to PowerOfPiConverter
Browse files Browse the repository at this point in the history
  • Loading branch information
keilw committed Oct 14, 2018
1 parent 2155059 commit 7005da1
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -80,14 +80,14 @@ public void testConvertBigDecimalMethod() {
public void testEquality() {
PowerOfPiConverter a = new PowerOfPiConverter(-1);
PowerOfPiConverter b = new PowerOfPiConverter(-1);
PowerOfPiConverter c = new PowerOfPiConverter(1);
PowerOfPiConverter c = PowerOfPiConverter.ONE;
assertTrue(a.equals(b));
assertFalse(a.equals(c));
}

@Test
public void isLinear() {
PowerOfPiConverter converter = new PowerOfPiConverter(-1);
PowerOfPiConverter converter = PowerOfPiConverter.of(-1);
assertTrue(converter.isLinear());
}

Expand All @@ -107,7 +107,7 @@ public void piBigDecimalDefaultPrecision() {

@Test
public void piBigDecimalExtendedPrecision() {
PowerOfPiConverter converter = new PowerOfPiConverter(1);
PowerOfPiConverter converter = PowerOfPiConverter.ONE;
Calculus.MATH_CONTEXT = new MathContext(MathContext.DECIMAL128.getPrecision() * 2);
BigDecimal value = (BigDecimal) converter.convert(BigDecimal.valueOf(1.));
//[ahuber] last digit should actually round to '2' instead of '0',
Expand All @@ -122,5 +122,4 @@ public void toStringTest() {
PowerOfPiConverter converter = new PowerOfPiConverter(2);
assertEquals("PowerOfPi(x -> x * π^2)", converter.toString());
}

}

0 comments on commit 7005da1

Please sign in to comment.