Пример #1
0
  @Test
  public void testSingleValConstructor() {
    MyDouble cVal = new MyDouble(27.8);

    QuadraticEquation testQuad = new QuadraticEquation(cVal);
    assertTrue(
        testQuad.getA().isZero() && testQuad.getB().isZero() && testQuad.getC().equals(cVal));
  }
Пример #2
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()));
 }
Пример #3
0
  @Test
  public void testThreeValConstructor() {
    MyDouble aVal = new MyDouble(15.7);
    MyDouble bVal = new MyDouble(-23.7);
    MyDouble cVal = new MyDouble(4.3);

    QuadraticEquation testQuad = new QuadraticEquation(aVal, bVal, cVal);
    assertTrue(
        testQuad.getA().equals(aVal)
            && testQuad.getB().equals(bVal)
            && testQuad.getC().equals(cVal));
  }
Пример #4
0
 @Test
 public void testDefaultConstructor() {
   QuadraticEquation testQuad = new QuadraticEquation();
   assertTrue(testQuad.getA().isZero() && testQuad.getB().isZero() && testQuad.getC().isZero());
 }