Skip to content

Commit

Permalink
move tests to new folders
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarwell committed May 19, 2019
1 parent d3abd05 commit 57c4c12
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public void testToCompressedInt_ulong_max() {
final CompressedInt bytes = CompressedIntFactory.valueOf(unsignedLongValue);

final String binaryString = byteArrayToBinaryString(bytes.getCompressedBytes());
System.out.println("" + new BigInteger(1, bytes.getCompressedBytes()).toString(16));

Assertions.assertEquals("1111111011111110111111101111111011111110111111101111111011111110111111110000001", binaryString);
}
Expand Down Expand Up @@ -143,6 +144,23 @@ public void testToUnsignedInt() {
Assertions.assertEquals(394L, unsignedLong);
}

@Test
public void testUnsignedIntMax() {
final BigInteger maxUnsignedInt = new BigInteger("4294967295", 10);
final CompressedInt compressedInt = CompressedIntFactory.valueOf(maxUnsignedInt.longValueExact());

Assertions.assertEquals("7f7f7f7f8f", new BigInteger(1, compressedInt.getCompressedBytes()).toString(16));
}

@Test
public void testLongValue() {
final long maxUnsingnedIntAsLong = 4_294_967_295L;
final CompressedInt compressedInt = CompressedIntFactory.valueOf(maxUnsingnedIntAsLong);

Assertions.assertEquals("7f7f7f7f8f", new BigInteger(1, compressedInt.getCompressedBytes()).toString(16));

}

@Test
public void testExceptionOnBigLongToInt() {
final CompressedInt compressedInt = CompressedIntFactory.valueOf(0xffffffff00ffffL);
Expand All @@ -162,6 +180,7 @@ public void testExceptionOnBigLongToUnsignedLong() {
final CompressedInt compressedInt = CompressedIntFactory.valueOf(-1L);

Assertions.assertEquals(-1L, compressedInt.getUnsignedLongValue());
Assertions.assertEquals("7f7f7f7f7f7f7f7f7f81", new BigInteger(1, compressedInt.getCompressedBytes()).toString(16));
}

@Test
Expand Down

0 comments on commit 57c4c12

Please # to comment.