/** * Stress test using an encoder with NO bits reversed and rotated into the * high bits of the long value and random values for the partition * identifier and the local counter. */ public void test_encode_decode_0bits_stress() { final Random r = new Random(); final TermIdEncoder encoder = new TermIdEncoder(0); for (int i = 0; i < 1000000; i++) { final long v0 = r.nextLong(); if (v0 == 0L) { // Do not attempt to encode a NULL. continue; } // Encode. final long v1 = encoder.encode(v0); final long v2 = encoder.encode2(v0); assertTrue(v1==v2); // verify same behavior. // Verify does not cause any transform of the value. if (v0 != v1) fail(encoder, v0, v1); } }
encoder.encode(0L); fail("Expecting: " + IllegalArgumentException.class); } catch (IllegalArgumentException ex) {
/** * Stress test using an encoder with NO bits reversed and rotated into the * high bits of the long value and random values for the partition * identifier and the local counter. */ public void test_encode_decode_0bits_stress() { final Random r = new Random(); final TermIdEncoder encoder = new TermIdEncoder(0); for (int i = 0; i < 1000000; i++) { final long v0 = r.nextLong(); if (v0 == 0L) { // Do not attempt to encode a NULL. continue; } // Encode. final long v1 = encoder.encode(v0); final long v2 = encoder.encode2(v0); assertTrue(v1==v2); // verify same behavior. // Verify does not cause any transform of the value. if (v0 != v1) fail(encoder, v0, v1); } }
encoder.encode(0L); fail("Expecting: " + IllegalArgumentException.class); } catch (IllegalArgumentException ex) {
final long ev = encoder.encode(v0);
encoder.encode(0L); fail("Expecting: " + IllegalArgumentException.class); } catch (IllegalArgumentException ex) {
final long ev = encoder.encode(v0);
/** * Stress test using an encoder with NO bits reversed and rotated into the * high bits of the long value and random values for the partition * identifier and the local counter. */ public void test_encode_decode_0bits_stress() { final Random r = new Random(); final TermIdEncoder encoder = new TermIdEncoder(0); for (int i = 0; i < 1000000; i++) { final long v0 = r.nextLong(); if (v0 == 0L) { // Do not attempt to encode a NULL. continue; } // Encode. final long v1 = encoder.encode(v0); final long v2 = encoder.encode2(v0); assertTrue(v1==v2); // verify same behavior. // Verify does not cause any transform of the value. if (v0 != v1) fail(encoder, v0, v1); } }
final long u = encoder.encode(v0); final long u1 = encoder.encode2(v0); assertTrue(u == u1);
final long u = encoder.encode(v0); final long u1 = encoder.encode2(v0); assertTrue(u == u1);
final long ev = encoder.encode(v0);
final long u = encoder.encode(v0); final long u1 = encoder.encode2(v0); assertTrue(u == u1);