public class TestShortPacker
extends junit.framework.TestCase
DataInputBuffer
and the ByteArrayBuffer
.Modifier and Type | Field and Description |
---|---|
static long |
SIGN_MASK |
Constructor and Description |
---|
TestShortPacker() |
TestShortPacker(String name) |
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(String msg,
byte[] expected,
byte[] actual) |
void |
doPackTest(short v,
byte[] expected) |
void |
doStressTest(int ntrials,
com.bigdata.io.TestShortPacker.ShortGenerator g)
Run a stress test.
|
void |
doUnpackTest(short expected,
byte[] packed)
Unpacks a short value.
|
void |
test_compatiblity_DataOutputBuffer_ShortPacker()
This test packs the data using a
DataOutputBuffer and unpacks it
using the ShortPacker . |
void |
test_compatiblity_ShortPacker_DataInputBuffer()
This test packs the data using the
ShortPacker and unpacks it
using a DataInputBuffer . |
void |
test_rejectNegatives() |
void |
testHighBit() |
void |
testPack() |
void |
testStressRandom()
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 short 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 TestShortPacker()
public TestShortPacker(String name)
name
- public void doUnpackTest(short 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 void testUnpack() throws IOException
IOException
public void doPackTest(short v, byte[] expected) throws IOException
IOException
public void testPack() throws IOException
IOException
public void test_rejectNegatives() throws IOException
IOException
public void testHighBit()
public void testStressSequence() throws IOException
Short.MAX_VALUE
by one (dense coverage).IOException
public void testStressRandom() throws IOException
IOException
public void doStressTest(int ntrials, com.bigdata.io.TestShortPacker.ShortGenerator 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_ShortPacker_DataInputBuffer() throws IOException
ShortPacker
and unpacks it
using a DataInputBuffer
.IOException
public void test_compatiblity_DataOutputBuffer_ShortPacker() throws IOException
DataOutputBuffer
and unpacks it
using the ShortPacker
.IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.