+
+ struct huffman_table* tbl = &tables[DC_CLASS][0];
+ for (unsigned i = 0; i < 12; ++i) {
+ assert(tbl->huffsize[i] == expected_table[i].code_length);
+ assert(tbl->huffcode[i] == expected_table[i].code_word);
+ }
+}
+
+// Test that we can decode a simple bit stream.
+// Note that since we end on a long code, we won't crash into
+// the end-of-stream problems we currently have.
+void test_decoding()
+{
+ huffman_tables_t tables;
+ read_example_tables(&tables);
+
+ // Our stream looks like this:
+ //
+ // 0 1 2 3 4 5 6 7 8 9 10 11
+ // 00 010 011 100 101 110 1110 11110 111110 1111110 11111110 111111110
+ uint8_t bytes[] = {
+ 0x13, 0x97, 0x77, 0xbe, 0xfd, 0xfd, 0xfe
+ };