Permalink
Browse files

Move BigRational and BigDouble tests to correct place

  • Loading branch information...
1 parent 40abe92 commit a29a7a4f86d4b3b7c7526419bb305dd8f2a8cc59 @mikera committed Oct 23, 2012
@@ -0,0 +1,22 @@
+package mikera.data;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class BigDoubleTest {
+
+ @Test public void testBigDouble() {
+ BigDouble bf=new BigDouble(2.0);
+ bf=bf.multiply(2);
+ bf=bf.subtract(1.5);
+ bf=bf.add(0.5);
+ bf=bf.divide(3);
+ assertEquals(1,bf.doubleValue(),0.000001);
+
+ bf=BigDouble.exp(9);
+ bf=bf.multiply(bf);
+ assertEquals(18,bf.log(),0.000001);
+ }
+
+}
@@ -12,4 +12,18 @@
assertEquals(b1,b2);
}
+
+
+ @Test public void testBigRational() {
+ BigRational br=new BigRational(10,2);
+ assertEquals("5",br.toString());
+
+ BigRational br2=new BigRational(1,-2);
+ assertEquals("-1/2",br2.toString());
+ assertEquals(-0.5,br2.doubleValue(),0.0001);
+
+ assertEquals("9/2",br.add(br2).toString());
+ }
+
+
}
@@ -1,8 +1,6 @@
package mikera.util;
import static org.junit.Assert.assertEquals;
-import mikera.data.BigDouble;
-import mikera.data.BigRational;
import mikera.math.PerlinNoise;
import mikera.util.Maths;
import mikera.util.Rand;
@@ -150,28 +148,6 @@
assertEquals(f,f,0.01f);
}
}
-
- @Test public void testBigFloat() {
- BigDouble bf=new BigDouble(2.0);
- bf=bf.multiply(2);
- bf=bf.subtract(1.5);
- bf=bf.add(0.5);
- bf=bf.divide(3);
- assertEquals(1,bf.doubleValue(),0.000001);
-
- bf=BigDouble.exp(9);
- bf=bf.multiply(bf);
- assertEquals(18,bf.log(),0.000001);
- }
-
- @Test public void testBigRational() {
- BigRational br=new BigRational(10,2);
- assertEquals("5",br.toString());
-
- BigRational br2=new BigRational(1,-2);
- assertEquals("-1/2",br2.toString());
- assertEquals(-0.5,br2.doubleValue(),0.0001);
-
- assertEquals("9/2",br.add(br2).toString());
- }
+
+
}

0 comments on commit a29a7a4

Please sign in to comment.