Search in sources :

Example 21 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testOfStringNegInfty.

@Test
public void testOfStringNegInfty() {
    ExtendedRational a = ExtendedRational.ofString("-Infinity");
    assertThat(a).isEqualTo(ExtendedRational.NEG_INFTY);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 22 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testSubtraction.

@Test
public void testSubtraction() {
    ExtendedRational a = ExtendedRational.ofString("5/2");
    ExtendedRational b = ExtendedRational.ofString("3/2");
    assertThat(a.minus(b)).isEqualTo(new ExtendedRational(Rational.ofLong(1)));
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 23 with ExtendedRational

use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.

the class ExtendedRationalTest method testAdditionInfinities.

@Test
public void testAdditionInfinities() {
    ExtendedRational a = ExtendedRational.INFTY;
    ExtendedRational b = ExtendedRational.NEG_INFTY;
    assertThat(a.plus(b)).isEqualTo(ExtendedRational.NaN);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)23 ExtendedRational (org.sosy_lab.common.rationals.ExtendedRational)23 Var (com.google.errorprone.annotations.Var)2