Search in sources :

Example 1 with ExtendedRational

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

the class ExtendedRationalTest method testIsRationalInfty.

@Test
public void testIsRationalInfty() {
    ExtendedRational x = ExtendedRational.INFTY;
    assertThat(x.isRational()).isFalse();
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 2 with ExtendedRational

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

the class ExtendedRationalTest method testAdditionInfty.

@Test
public void testAdditionInfty() {
    ExtendedRational a = new ExtendedRational(Rational.ofLongs(12, 8));
    ExtendedRational b = ExtendedRational.INFTY;
    assertThat(a.plus(b)).isEqualTo(ExtendedRational.INFTY);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 3 with ExtendedRational

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

the class ExtendedRationalTest method testDivisionInfty.

@Test
public void testDivisionInfty() {
    ExtendedRational a = ExtendedRational.ofString("234234");
    ExtendedRational b = ExtendedRational.INFTY;
    assertThat(a.divides(b)).isEqualTo(new ExtendedRational(Rational.ofLong(0)));
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Test(org.junit.Test)

Example 4 with ExtendedRational

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

the class ExtendedRationalTest method testMultiplicationZero.

@Test
public void testMultiplicationZero() {
    @Var ExtendedRational a = ExtendedRational.ZERO;
    @Var ExtendedRational b = ExtendedRational.NEG_INFTY;
    assertThat(a.times(b)).isEqualTo(ExtendedRational.ZERO);
    a = ExtendedRational.ZERO;
    b = ExtendedRational.INFTY;
    assertThat(a.times(b)).isEqualTo(ExtendedRational.ZERO);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Var(com.google.errorprone.annotations.Var) Test(org.junit.Test)

Example 5 with ExtendedRational

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

the class ExtendedRationalTest method testMultiplicationNegInfty.

@Test
public void testMultiplicationNegInfty() {
    ExtendedRational a = ExtendedRational.NEG_INFTY;
    @Var ExtendedRational b = ExtendedRational.NEG_INFTY;
    assertThat(a.times(b)).isEqualTo(ExtendedRational.INFTY);
    b = ExtendedRational.INFTY;
    assertThat(a.times(b)).isEqualTo(ExtendedRational.NEG_INFTY);
}
Also used : ExtendedRational(org.sosy_lab.common.rationals.ExtendedRational) Var(com.google.errorprone.annotations.Var) 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