/** * OVERVIEW: The test case "test12" covers around 1.0% (low percentage) of statements in * "Rational" */ @Test public void test12() throws Throwable { // The test case instantiates a "Rational" with numerator equal to 1L, // and denominator equal to -4269L. // The execution of this constructor implicitly covers the following 1 // conditions: // - the condition " denominator equals to 0L" is FALSE; Rational rational0 = new Rational(1L, (-4269L)); // The test case declares a double whose value is equal to the double // value of "rational0" double double0 = rational0.doubleValue(); // Then, it tests: // 1) whether "double0" is equal to (-2.3424689622862497E-4) with delta // equal to 0.01D; assertEquals((-2.3424689622862497E-4), double0, 0.01D); }
/** * OVERVIEW: The test case "test1" covers around 7.0% (low percentage) of statements in "Rational" */ @Test public void test1() throws Throwable { // The test case instantiates a "Rational" with numerator equal to // -85L, and denominator equal to 232L. // The execution of this constructor implicitly covers the following 1 // conditions: // - the condition " denominator equals to 0L" is FALSE; Rational rational0 = new Rational((-85L), 232L); // The test case declares an object of the class "Rational" whose value // is equal to the absolute value of "rational0" Rational rational1 = rational0.abs(); // Then, it tests: // 1) whether the double value of "rational1" is equal // to 0.36637931034483 with delta equal to 0.01D; assertEquals(0.36637931034483, rational1.doubleValue(), 0.01D); // 2) whether the numerator of rational1 is equal to 85L; assertEquals(85L, rational1.numerator); // 3) whether the denominator of rational1 is equal to 85L; assertEquals(232L, rational1.denominator); }
/** * OVERVIEW: The test case "test3" covers around 1.0% (low percentage) of statements in "Rational" */ @Test public void test3() throws Throwable { // The test case instantiates a "Rational" with numerator equal to -6L, // and denominator equal to 231L. // The execution of this constructor implicitly covers the following 1 // conditions: // - the condition " denominator equals to 0L" is FALSE; Rational rational0 = new Rational((-6L), 231L); try { // The next method call the add long integer -66L to rational0 // FIXME: rational0 value was not updated rational0 = rational0.add((-66L)); // FIXME: this test says that we cannot add any number to a Rationale // fail("Expecting exception: NumberFormatException"); assertEquals(-66.02597402597402, rational0.doubleValue(), 0.01D); } catch (NumberFormatException e) { // // Cannot create a Rational object with zero as the denominator // } }
@Test public void test12() throws Throwable { Rational rational0 = new Rational((-1784L), 669L); double double0 = rational0.doubleValue(); assertEquals((-2.6666666666666665), double0, 0.01D); }