/** * OVERVIEW: The test case "test7" covers around 6.0% (low percentage) of statements in "Rational" */ @Test public void test7() throws Throwable { // The test case instantiates a "Rational" with numerator equal to -1L, // and denominator equal to -1L. // The execution of this constructor implicitly covers the following 1 // conditions: // - the condition " denominator equals to 0L" is FALSE; Rational rational0 = new Rational((-1L), (-1L)); // The test case declares an object of the class "Rational" whose value // is the power of "rational0" Rational rational1 = rational0.pow(3404); // Then, it tests: // 1) whether the integer value of "rational1" is equal to 1; assertEquals(1, rational1.intValue()); // 2) whether the short value of "rational1" is equal to 1; assertEquals(1, rational1.shortValue()); }
/** * OVERVIEW: The test case "test0" covers around 7.0% (low percentage) of statements in "Rational" */ @Test public void test0() throws Throwable { // The test case instantiates a "Rational" with numerator equal to // -82L, and denominator equal to -82L. // The execution of this constructor implicitly covers the following 1 // conditions: // - the condition " denominator equals to 0L" is FALSE; Rational rational0 = new Rational((-82L), (-82L)); // 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 integer value of "rational1" is equal to -1; // FIXME: This assertion should test if the absolute value is equal to 1 // and not -1, because an absolute value is always positive // assertEquals(-1, rational1.intValue()); assertEquals(1, rational1.intValue()); // 2) whether the denominator of rational1 is equal to (-82L); // FIXME: This assertion should test if the absolute value of // the denominator is 82L and not -82L assertEquals((82L), rational1.denominator); }