use of org.graalvm.shadowed.org.jcodings.Encoding in project graal by oracle.
the class TStringConstructorTests method testFromLong.
@Test
public void testFromLong() throws Exception {
forAllEncodings((TruffleString.Encoding encoding) -> {
for (long l : new long[] { Long.MIN_VALUE, Long.MIN_VALUE + 1, ((long) Integer.MIN_VALUE) - 1, Integer.MIN_VALUE, Integer.MIN_VALUE + 1, Short.MIN_VALUE, -12345, -1, 0, 1, 12345, Short.MAX_VALUE, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, ((long) Integer.MAX_VALUE) + 1, Long.MAX_VALUE - 1, Long.MAX_VALUE }) {
if (isAsciiCompatible(encoding)) {
TruffleString eager = fromLongUncached(l, encoding, false);
Assert.assertEquals(l, eager.parseLongUncached());
Assert.assertEquals(l, eager.parseDoubleUncached(), 0);
TruffleString lazy = fromLongUncached(l, encoding, true);
Assert.assertEquals(l, lazy.parseDoubleUncached(), 0);
if ((int) l == l) {
Assert.assertEquals(l, eager.parseIntUncached());
Assert.assertEquals(l, lazy.parseIntUncached());
}
} else {
expectUnsupportedOperationException(() -> fromLongUncached(l, encoding, false));
expectUnsupportedOperationException(() -> fromLongUncached(l, encoding, true));
}
}
});
}
Aggregations