Search in sources :

Example 1 with UnsignedLong

use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.

the class UnsignedLongTest method testTimes.

@Test
public void testTimes() {
    UnsignedLong fortyTwo = new UnsignedLong(42);
    Assert.assertEquals(42 * 42, fortyTwo.times(42).asLong());
    Assert.assertEquals(0xffff_ffff_ffff_fff0L, fortyTwo.times(0x618618618618618L).asLong());
}
Also used : UnsignedLong(org.graalvm.compiler.core.common.util.UnsignedLong) Test(org.junit.Test)

Example 2 with UnsignedLong

use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.

the class UnsignedLongTest method testIsLessThan.

@Test
public void testIsLessThan() {
    UnsignedLong fortyTwo = new UnsignedLong(42);
    Assert.assertTrue(fortyTwo.isLessThan(45));
    Assert.assertFalse(fortyTwo.isLessThan(42));
    Assert.assertFalse(fortyTwo.isLessThan(40));
    Assert.assertTrue(fortyTwo.isLessThan(0xffff_ffff_ffff_ffffL));
    UnsignedLong longUnsigned = new UnsignedLong(0x8000_7777_0000_8888L);
    Assert.assertTrue(longUnsigned.isLessThan(0xffff_ffff_ffff_ffffL));
    Assert.assertFalse(longUnsigned.isLessThan(42));
    Assert.assertFalse(longUnsigned.isLessThan(0x8000_0777_0000_8888L));
    Assert.assertFalse(longUnsigned.isLessThan(0x8000_7777_0000_8888L));
}
Also used : UnsignedLong(org.graalvm.compiler.core.common.util.UnsignedLong) Test(org.junit.Test)

Example 3 with UnsignedLong

use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.

the class UnsignedLongTest method testTimesException.

@Test(expected = ArithmeticException.class)
public void testTimesException() {
    UnsignedLong fortyTwo = new UnsignedLong(42);
    fortyTwo.times(0x618618618618619L);
}
Also used : UnsignedLong(org.graalvm.compiler.core.common.util.UnsignedLong) Test(org.junit.Test)

Example 4 with UnsignedLong

use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.

the class UnsignedLongTest method testIsLessOrEqualTo.

@Test
public void testIsLessOrEqualTo() {
    UnsignedLong fortyTwo = new UnsignedLong(42);
    Assert.assertTrue(fortyTwo.isLessOrEqualTo(45));
    Assert.assertTrue(fortyTwo.isLessOrEqualTo(42));
    Assert.assertFalse(fortyTwo.isLessOrEqualTo(40));
    Assert.assertTrue(fortyTwo.isLessOrEqualTo(0xffff_ffff_ffff_ffffL));
    UnsignedLong longUnsigned = new UnsignedLong(0x8000_7777_0000_8888L);
    Assert.assertTrue(longUnsigned.isLessOrEqualTo(0xffff_ffff_ffff_ffffL));
    Assert.assertFalse(longUnsigned.isLessOrEqualTo(42));
    Assert.assertFalse(longUnsigned.isLessOrEqualTo(0x8000_0777_0000_8888L));
    Assert.assertTrue(longUnsigned.isLessOrEqualTo(0x8000_7777_0000_8888L));
}
Also used : UnsignedLong(org.graalvm.compiler.core.common.util.UnsignedLong) Test(org.junit.Test)

Example 5 with UnsignedLong

use of org.graalvm.compiler.core.common.util.UnsignedLong in project graal by oracle.

the class UnsignedLongTest method testWrappingTimes.

@Test
public void testWrappingTimes() {
    UnsignedLong fortyTwo = new UnsignedLong(42);
    Assert.assertEquals(0x1a, fortyTwo.wrappingTimes(0x618618618618619L).asLong());
}
Also used : UnsignedLong(org.graalvm.compiler.core.common.util.UnsignedLong) Test(org.junit.Test)

Aggregations

UnsignedLong (org.graalvm.compiler.core.common.util.UnsignedLong)14 Test (org.junit.Test)13 OptionValues (org.graalvm.compiler.options.OptionValues)1