private void entryIDListToAndFromDatabase(long[] before) throws Exception { byte[] bytes = JebFormat.entryIDListToDatabase(before); /* * printError(String.format("encoded count=%d len=%d", * before.length, bytes.length)); */ long[] after = JebFormat.entryIDListFromDatabase(bytes); assertTrue(Arrays.equals(before, after)); }
/** * Test entry IDs. * * @throws Exception If the test failed unexpectedly. */ @Test() public void testEntryIDToAndFromDatabase() throws Exception { long[] vals = {128, 1234567, 0, 1, -1, 2 ^ 32 - 1, 2 ^ 63 - 1}; for (long before : vals) { byte[] bytes = JebFormat.entryIDToDatabase(before); long after = JebFormat.entryIDFromDatabase(bytes); assertEquals(before, after); } }