コード例 #1
0
 @Test
 public void testDerivative() {
   MyDouble a = new MyDouble(1);
   MyDouble b = new MyDouble(2);
   MyDouble c = new MyDouble(3);
   QuadraticEquation DiffQuad = new QuadraticEquation(a, b, c);
   MyDouble expOne = new MyDouble(2);
   MyDouble expTwo = new MyDouble(1);
   QuadraticEquation ResultQuad = new QuadraticEquation(a.multiply(expOne), b.multiply(expTwo));
   assertTrue(ResultQuad.equals(DiffQuad.derivative()));
 }
コード例 #2
0
 @Test
 public void testMultiply() {
   MyDouble a = new MyDouble(1);
   MyDouble b = new MyDouble(2);
   MyDouble c = new MyDouble(3);
   QuadraticEquation TestOneQuad = new QuadraticEquation(a, b, c);
   QuadraticEquation TestTwoQuad = new QuadraticEquation(a, b, c);
   QuadraticEquation MultiQuadNull = TestOneQuad.limitedMultiply(TestTwoQuad);
   assertEquals(null, MultiQuadNull);
   QuadraticEquation TestThreeQuad = new QuadraticEquation(c);
   QuadraticEquation MultiQuad = TestOneQuad.limitedMultiply(TestThreeQuad);
   QuadraticEquation MultiTest =
       new QuadraticEquation(a.multiply(c), b.multiply(c), c.multiply(c));
   assertTrue(MultiQuad.equals(MultiTest));
 }