コード例 #1
0
 @Test
 public void test10() throws Throwable {
   Rational rational0 = new Rational(1L, 1L);
   Rational rational1 = rational0.divide(1L);
   assertEquals(1.0F, rational0.floatValue(), 0.01F);
   assertEquals(1L, rational1.longValue());
 }
コード例 #2
0
 @Test
 public void test0() throws Throwable {
   Rational rational0 = new Rational((-3671L), (-3671L));
   Rational rational1 = rational0.divide(rational0);
   assertEquals(1L, rational1.numerator);
   assertEquals(1L, rational1.floatValue(), 0.01F);
 }
コード例 #3
0
 /**
  * OVERVIEW: The test case "test10" covers around 6.0% (low percentage) of statements in
  * "Rational"
  */
 @Test
 public void test10() 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 divide of "rational0"
   Rational rational1 = rational0.divide((-1L));
   // Then, it tests:
   // 1) whether the numerator of rational1 is equal to (-1L);
   assertEquals((-1L), rational1.numerator);
   // 2) whether the denominator of rational1 is equal to 1L;
   assertEquals(1L, rational1.denominator);
   // 3) whether the float value of "rational0" is equal to 1.0F with delta
   // equal to 0.01D;
   assertEquals(1.0F, rational0.floatValue(), 0.01F);
 }