public class TestCanonicalHuffmanRabaCoder extends AbstractRabaCoderTestCase
CanonicalHuffmanRabaCoder
.AbstractRabaCoderTestCase.TestOp
TestCase2.MyProperties, TestCase2.RandomType
rabaCoder, scalingFactor
_randomType, log
Constructor and Description |
---|
TestCanonicalHuffmanRabaCoder() |
TestCanonicalHuffmanRabaCoder(String name) |
Modifier and Type | Method and Description |
---|---|
void |
doRecoderRoundTripTest(int[] frequency)
Verify we can regenerate the
Fast64CodeWordCoder from the code
word[]. |
void |
doRoundTripTest(int[] frequency)
This verifies that a code book constructed from a given set of
frequencies may be reconstructed from the cord word bit lengths, given in
a non-decreasing order, together with the symbols in a correlated array.
|
protected static String |
printCodeBook(BitVector[] codeWords)
Format the code book as a multi-line string.
|
protected void |
setUp() |
void |
test_confirm_InputBitStream_compatible() |
void |
test_emptyKeyRabaSetup()
Unit test for processing an empty
IRaba representing B+Tree keys. |
void |
test_emptyValueRabaSetup()
Unit test for processing an empty
IRaba representing B+Tree
values. |
void |
test_huffmanCodec_noSymbols()
This test was written to a bug in
HuffmanCodec , which has since
been fixed. |
void |
test_huffmanCodec_oneSymbols()
This test was written to a bug in
HuffmanCodec , which has since
been fixed. |
void |
test_huffmanCodec01()
Test with a simple fixed frequency[].
|
void |
test_huffmanCodecStress()
Stress test with random frequency distributions of between 2 and 256
distinct symbols.
|
void |
test_huffmanRecoder01()
Simple test with a known symbol frequency distribution.
|
void |
test_huffmanRecoderStress()
Stress test with 256 distinct symbols (corresponding to byte values in
the application).
|
void |
test_keyRabaSetup()
Unit test for processing an
IRaba representing B+Tree keys
suitable to setup the data for compression. |
void |
test_stress_InputBitStream_compatible()
A stress test for compatibility with
InputBitStream . |
void |
test_valueRabaSetup()
Unit test for processing an
IRaba representing B+Tree values
suitable to setup the data for compression. |
assertSameIterator, doRabaCoderPerformanceTest, doRandomRoundTripTest, doRoundTripTest, getRandomValue, isFixedLength, main, test_empty, test_emptyElement, test_entryCount1, test_entryCount2, test_error1, test_error2, test_keyCoderPerformance, test_mike_personick, test_negativeByteValues, test_nsymbolsOne_nulls, test_nsymbolsOne, test_randomOnce, test_randomURIs, test_withNulls, test_withNulls2, testStress
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsWithinUlps, assertSameArray, assertSameArray, assertSameBigDecimal, assertSameBigDecimal, assertSameBigInteger, assertSameBigInteger, assertSameIterator, assertSameIterator, assertSameIteratorAnyOrder, assertSameIteratorAnyOrder, assertSameValue, assertSameValue, assertZeroUlps, assertZeroUlps, fail, getInnerCause, getNormalInt, getProjectBuildPath, getProperties, getRandomObject, getRandomObject, getRandomOrder, getRandomString, getTestInputStream, getTestResource, getTestResource, getUlps, getUlps, isDEBUG, isDEBUG, isINFO, isINFO, isInnerCause, logProperties
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, tearDown, toString
public TestCanonicalHuffmanRabaCoder()
public TestCanonicalHuffmanRabaCoder(String name)
name
- protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected static String printCodeBook(BitVector[] codeWords)
codeWords
- The code words.public void test_huffmanCodec01()
public void test_huffmanCodec_noSymbols()
HuffmanCodec
, which has since
been fixed.
java.lang.ArrayIndexOutOfBoundsException: -2 at it.unimi.dsi.compression.CanonicalFast64CodeWordDecoder.<init>(CanonicalFast64CodeWordDecoder.java:62) at it.unimi.dsi.compression.HuffmanCodec.<init>(HuffmanCodec.java:107) at com.bigdata.btree.raba.codec.TestCanonicalHuffmanRabaCoder.doRoundTripTest(TestCanonicalHuffmanRabaCoder.java:166) at com.bigdata.btree.raba.codec.TestCanonicalHuffmanRabaCoder.test_huffmanCodec_noSymbols(TestCanonicalHuffmanRabaCoder.java:121)
public void test_huffmanCodec_oneSymbols()
HuffmanCodec
, which has since
been fixed.
java.lang.ArrayIndexOutOfBoundsException: -1 at it.unimi.dsi.compression.CanonicalFast64CodeWordDecoder.<init>(CanonicalFast64CodeWordDecoder.java:89) at it.unimi.dsi.compression.HuffmanCodec.<init>(HuffmanCodec.java:107) at com.bigdata.btree.raba.codec.TestCanonicalHuffmanRabaCoder.doRoundTripTest(TestCanonicalHuffmanRabaCoder.java:166) at com.bigdata.btree.raba.codec.TestCanonicalHuffmanRabaCoder.test_huffmanCodec_oneSymbols(TestCanonicalHuffmanRabaCoder.java:132)
public void test_huffmanCodecStress()
public void doRoundTripTest(int[] frequency)
frequency
- public void test_huffmanRecoderStress() throws IOException
IOException
public void test_huffmanRecoder01() throws IOException
IOException
public void doRecoderRoundTripTest(int[] frequency) throws IOException
Fast64CodeWordCoder
from the code
word[]. This is tested by coding and decoding random symbol sequences.
For this test we need to reconstruct the Fast64CodeWordCoder
. To
do that, we need to use the codeWord[] and create a long[] having the
same values as the codeWords, but expressed as 64-bit integers.frequency
- The frequency[] should include a reasonable proportion of
symbols with a zero frequency in order to replicate the
expected conditions when coding non-random data such as are
found in the keys of a B+Tree.IOException
public void test_emptyKeyRabaSetup() throws IOException
IRaba
representing B+Tree keys.
For an empty IRaba
, CanonicalHuffmanRabaCoder.RabaCodingSetup
actually assigns
null
for the HuffmanCodec.DecoderInputs
due to a bug in the
HuffmanCodec
when nsymbols == 0. Therefore, this verifies that
the Coder
and HuffmanCodec.DecoderInputs
are null
and
that the symbol count is zero.
IOException
public void test_keyRabaSetup() throws IOException
IRaba
representing B+Tree keys
suitable to setup the data for compression.IOException
public void test_valueRabaSetup() throws IOException
IRaba
representing B+Tree values
suitable to setup the data for compression.IOException
public void test_emptyValueRabaSetup() throws IOException
IRaba
representing B+Tree
values.
For an empty IRaba
, CanonicalHuffmanRabaCoder.RabaCodingSetup
actually assigns
null
for the HuffmanCodec.DecoderInputs
due to a bug in the
HuffmanCodec
when nsymbols == 0. Therefore, this verifies that
the Coder
and HuffmanCodec.DecoderInputs
are null
and
that the symbol count is zero.
IOException
public void test_stress_InputBitStream_compatible() throws IOException
InputBitStream
. An array is
filled with random bits and the behavior of InputBitStream
and
BytesUtil.getBits(byte[], int, int)
is compared on a number of
randomly selected bit slices.
TODO Could be a performance comparison.IOException
public void test_confirm_InputBitStream_compatible() throws IOException
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.