public void testUnsignedCompare() {
long a = 1L;
long b = 1L;
+ int result;
- int result = Utils.unsignedCompare(a, b);
+ result = Utils.unsignedCompare(a, b);
assertEquals(0, result);
+
+ result = Utils.unsignedCompare(0L, 1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(0xFFFFFFFFL, 0x100000000L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(-4L, -1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(-0x80000000L, -1L);
+ assertEquals(-1, result);
+ result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFEL, 0x7FFFFFFFFFFFFFFFL);
+ assertEquals(-1, result);
+
+ result = Utils.unsignedCompare(1L, 0L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(0x100000000L, 0xFFFFFFFFL);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(-1L, -4L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(-1L, -0x80000000L);
+ assertEquals(1, result);
+ result = Utils.unsignedCompare(0x7FFFFFFFFFFFFFFFL, 0x7FFFFFFFFFFFFFFEL);
+ assertEquals(1, result);
}
}
\ No newline at end of file