public class TestLongPacker
extends junit.framework.TestCase
DataInputBuffer
and the ByteArrayBuffer
.Modifier and Type | Field and Description |
---|---|
static long |
SIGN_MASK |
Constructor and Description |
---|
TestLongPacker() |
TestLongPacker(String name) |
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(String msg,
byte[] expected,
byte[] actual) |
void |
doPackTest(long v,
byte[] expected) |
void |
doStressTest(int ntrials,
com.bigdata.io.TestLongPacker.LongGenerator g)
Run a stress test.
|
void |
doUnpackTest(long expected,
byte[] packed)
Unpacks a long.
|
int |
getNBytes(int firstByte)
Given the first byte of a packed long value, return the #of bytes into which
that value was packed (including this one).
|
void |
test_compatiblity_DataOutputBuffer_LongPacker()
This test packs the data using a
DataOutputBuffer and unpacks it
using the LongPacker . |
void |
test_compatiblity_LongPacker_DataInputBuffer()
This test packs the data using the
LongPacker and unpacks it
using a DataInputBuffer . |
void |
test_getNibbleLength() |
void |
testHighBit() |
void |
testNBytes() |
void |
testPack() |
void |
testStressRandom()
Run a large #of random pack/unpack operations to sample the space while
showing correctness on those samples.
|
void |
testStressRandomNonNegativeLeadingZeros()
Run a large #of random pack/unpack operations to sample the space while
showing correctness on those samples.
|
void |
testStressSequence()
Run a large #of pack/unpack operations on a sequence of long values to
demonstrate correctness in that sequence.
|
void |
testUnpack() |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
public static final long SIGN_MASK
public TestLongPacker()
public TestLongPacker(String name)
name
- public void doUnpackTest(long expected, byte[] packed) throws IOException
expected
- The expected long value.packed
- The packed byte[].IOException
- If there was not enough data.junit.framework.AssertionFailedError
- If there is too much data.public int getNBytes(int firstByte)
firstByte
- The first byte.public void testNBytes()
public void testUnpack() throws IOException
IOException
public void doPackTest(long v, byte[] expected) throws IOException
IOException
public void test_getNibbleLength()
public void testPack() throws IOException
IOException
public void testHighBit()
public void testStressSequence() throws IOException
IOException
public void testStressRandom() throws IOException
IOException
public void testStressRandomNonNegativeLeadingZeros() throws IOException
IOException
public void doStressTest(int ntrials, com.bigdata.io.TestLongPacker.LongGenerator g) throws IOException
ntrials
- #of trials.g
- Generator for the long values.IOException
public static void assertEquals(String msg, byte[] expected, byte[] actual)
public void test_compatiblity_LongPacker_DataInputBuffer() throws IOException
LongPacker
and unpacks it
using a DataInputBuffer
.IOException
public void test_compatiblity_DataOutputBuffer_LongPacker() throws IOException
DataOutputBuffer
and unpacks it
using the LongPacker
.IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.