use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.
the class ExtendedRationalTest method testGetRational.
@Test
public void testGetRational() {
ExtendedRational a = ExtendedRational.ofString("3/4");
assertThat(a.getRational()).isEqualTo(Rational.ofString("3/4"));
}
use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.
the class ExtendedRationalTest method testOfStringNumber.
@Test
public void testOfStringNumber() {
ExtendedRational a = ExtendedRational.ofString("-2");
Assert.assertEquals(new ExtendedRational(Rational.ofLong(-2)), a);
}
use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.
the class ExtendedRationalTest method testInstantiation.
@Test
public void testInstantiation() {
ExtendedRational x;
x = new ExtendedRational(Rational.ofLongs(108, 96));
Assert.assertEquals("9/8", x.toString());
assertThat(x.toString()).isEqualTo("9/8");
}
use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.
the class ExtendedRationalTest method testAdditionNumbers.
@Test
public void testAdditionNumbers() {
ExtendedRational a = new ExtendedRational(Rational.ofLongs(12, 8));
ExtendedRational b = new ExtendedRational(Rational.ofLongs(-54, 12));
assertThat(a.plus(b)).isEqualTo(new ExtendedRational(Rational.ofLong(-3)));
}
use of org.sosy_lab.common.rationals.ExtendedRational in project java-common-lib by sosy-lab.
the class ExtendedRationalTest method testAdditionNegInfty.
@Test
public void testAdditionNegInfty() {
ExtendedRational a = ExtendedRational.ofString("2309820938409238490");
ExtendedRational b = ExtendedRational.NEG_INFTY;
assertThat(a.plus(b)).isEqualTo(ExtendedRational.NEG_INFTY);
}
Aggregations