コード例 #1
0
 // YOU NEED TO IMPLEMENT AT LEAST THESE JUNIT TESTS BELOW
 @Test
 public void testGetters() {
   MyDouble a = new MyDouble(3);
   MyDouble b = new MyDouble(4);
   MyDouble c = new MyDouble(5);
   QuadraticEquation testQuad = new QuadraticEquation(a, b, c);
   assertTrue(a.equals(testQuad.getA()));
   assertTrue(b.equals(testQuad.getB()));
   assertTrue(c.equals(testQuad.getC()));
 }
コード例 #2
0
 @Test
 public void testNormalize() {
   MyDouble a = new MyDouble(1);
   MyDouble b = new MyDouble(2);
   MyDouble c = new MyDouble(3);
   QuadraticEquation NormQuad = new QuadraticEquation(a, b, c);
   MyDouble norm = new MyDouble(a.square().add(b.square().add(c.square())));
   MyDouble normTest = new MyDouble(norm.sqrt());
   assertTrue(normTest.equals(NormQuad.normalize()));
 }