| 1 |
/* |
| 2 |
* Usage: test_huff_dec [-v] [-e] |
| 3 |
* |
| 4 |
* -v Verbose |
| 5 |
* -e Run expensive tests |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <assert.h> |
| 9 |
#include <stdio.h> |
| 10 |
#include <stdlib.h> |
| 11 |
#include <string.h> |
| 12 |
#ifdef WIN32 |
| 13 |
#include <getopt.h> |
| 14 |
#else |
| 15 |
#include <unistd.h> |
| 16 |
#endif |
| 17 |
|
| 18 |
#include "lsqpack.h" |
| 19 |
#include "lsqpack-test.h" |
| 20 |
|
| 21 |
#define MIN(a, b) ((a) < (b) ? (a) : (b)) |
| 22 |
|
| 23 |
static int verbose; |
| 24 |
|
| 25 |
struct test_huff_dec |
| 26 |
{ |
| 27 |
int lineno; |
| 28 |
|
| 29 |
/* Input */ |
| 30 |
unsigned char *src; |
| 31 |
size_t src_sz; |
| 32 |
|
| 33 |
/* Output */ |
| 34 |
char *dst; |
| 35 |
size_t dst_sz; |
| 36 |
}; |
| 37 |
|
| 38 |
const struct test_huff_dec tests[] = |
| 39 |
{ |
| 40 |
{ __LINE__, |
| 41 |
(unsigned char *) |
| 42 |
"\xbf\x6c\x85\xfa\x53\xc4\xe5\xb0\xaa\x19\x0a\x53\xe9\x42\x0e\xcf\xf3", |
| 43 |
17, |
| 44 |
"Dude, where is my car?", |
| 45 |
22, |
| 46 |
}, |
| 47 |
{ __LINE__, |
| 48 |
(unsigned char *) |
| 49 |
"\xd6\x32\x1a\xa9\x94\x8c\x64\xea\xa0\xea\x91\x49" |
| 50 |
"\x4f\x62\x67\x51\x33\x95\x4a\x0b\x54\xc9\x9d\x43\xca\xa2\x67\x2a" |
| 51 |
"\x93\x8d\x24\x9f\xc0\xfd\x21\x41\xd5\x22\x88\x1f\x71\xcc\x5a\x3d" |
| 52 |
"\x28\x49\xcb\xe0\xd5\x4d\xff\xff\xff\xe2\x67\x2a\x85\xaa\x45\x0f" |
| 53 |
"\x2a\x83\x50\x86\x98\x76\x7d\x29\xe0\x68\x51\x33\x95\x4a\x47\x52" |
| 54 |
"\x9e\x27\x3a\x0a\xa1\x06\x8b\x47\x42\x93\x50\x3a\x88\x55\x27\x1c" |
| 55 |
"\x8a\x58\x54\x12\xd2\xc8\xa5\x25\x52\x5b\x0f\x4f\xff\xff\xff\x89" |
| 56 |
"\x9c\xaa\x20\xa3\x5d\x45\x31\x99\x0a\x4e\x53\x4d\x3a\x54\xf0\x34" |
| 57 |
"\x29\x5d\x87\x8c\x71\xd1\xe9\x49\x4d\xdc\xaa\x4a\x52\xa5\x44\x96" |
| 58 |
"\xa5\x0d\x51\x27\x2a\x3e\x94\x3d\x8a\x24\xb5\x28\x3a\xa4\x50\x7f" |
| 59 |
"\xff\xff\xfe\x4e\x3a\x25\xfb\x52\x3b\x52\xa5\x3e\x94\x94\xd6\x21" |
| 60 |
"\x2a\x1a\x9a\xec\x2a\x10\x63\xd5\xf4\xa1\xec\x52\x52\x96\x85\x0f" |
| 61 |
"\x2a\x89\x9c\xaa\x52\x3a\xbe\x94\xf0\x34\x29\x51\xd2\xa1\xe5\x51" |
| 62 |
"\x33\x99\x1f\x4a\x47\x6a\x7f\xff\xff\xfc\x3c\xaa\x4e\x64\x28\x84" |
| 63 |
"\xd8\x5a\xa6\x4c\xeb\xa8\xa4\x35\x48\xa7\xa2\xa7\xe9\x4f\x13\x9a" |
| 64 |
"\x82\xa9\x39\x54\xf0\x34\x28\x79\x54\xa4\x68\x41\xbb\x95\x48\xed" |
| 65 |
"\x35\x12\x7d\x29\xe0\xc9\x9d\x48\xec\x38\xe4\xff\xff\xff\xf1\x13" |
| 66 |
"\x9e\xda\x24\x2d\x88\x50\x75\x48\xa4\x85\x2d\x6a\x12\x72\xa1\x3f" |
| 67 |
"\x4a\x64\x50\x87\xb6\x89\x14\xa8\xe9\x50\x93\x8e\xc1\x91\x25\xb0" |
| 68 |
"\xde\xca\xa4\xe6\x42\x88\x4d\x85\xaa\x64\xce\xa0\xd1\xff\xff\xff" |
| 69 |
"\xe5\x23\x42\x0d\xdc\xab\xa8\xa6\x44\xa9\xe0\x68\x53\xc4\xe3\x4a" |
| 70 |
"\x94\x9a\x69\xd2\xa4\x65\x51\x25\xb2\x92\xc8\xa0\xd4\x41\xaa\x2f" |
| 71 |
"\x8f\x5f\x4a\x75\xa8\xe9\x4f\xa5\x10\x9b\x0b\x54\xc9\x9f\xe9\x43" |
| 72 |
"\xca\xa2\x67\x2f\xff\xff\xff\x9d\x4d\x54\x8a\x78\x2a\x83\x41\x2c" |
| 73 |
"\x34\x65\x51\x27\x52\x82\x8e\xa5\x07\x54\x8a\x78\x35\x9e\x94\xa4" |
| 74 |
"\xb5\x7d\x29\x1d\xa9\x53\xc4\xe6\x24\xff\x4a\x1a\xa5\x27\x35\x3f" |
| 75 |
"\x4a\x46\x52\x0e\xd4\x15\x43\xca\xa4\xe6\x47\xff\xff\xff\x93\x94" |
| 76 |
"\x7d\xfd\x29\x1d\xa6\xa2\x4f\xa5\x2b\x1d\x89\x39\xfa\xa9\x49\xec" |
| 77 |
"\x2a\x87\x95\x44\xce\x55\x0b\x55\x03\xb2\x62\xc8\xa4\xc7\xb0\xd4" |
| 78 |
"\x50\x35\x0f\x64\x85\xb1\x75\x14\xd2\x74\xa8\x99\xc6\x95\x0d\x57" |
| 79 |
"\xff\xff\xff\x83\xae\xb2\x8e\xc1\xd4\x42\xa9\x39\x54\x41\x4b\x49" |
| 80 |
"\x64\x50\xd5\x28\x99\xca\xa5\x05\x1a\x12\xa4\xc7\xb0\xd4\x50\x35" |
| 81 |
"\xa8\x37\x52\xae\xa2\x9c\xa7\x1a\x54\xc8\xa0\xe9\x51\x09\xb0\xdd" |
| 82 |
"\xcd\x54\xca\x24\xff\xff\xff\xfe\x17\xcd\x76\x15\x08\x50\xc8\x51" |
| 83 |
"\x33\x99\x0a\x21\x36\x16\xa9\x93\x3a\x86\x4a\x0b\x44\xbf\x4a\x52" |
| 84 |
"\x7b\x0a\xa0\xd0\xa0\xd4\x4c\xe6\xaa\x65\x07\x58\xec\x4a\x92\xd8" |
| 85 |
"\x7a\x54\x9c\xc8\x52\xb9\xfd\x20\xc4\x1d\x1f\xff\xff\xfe\x20\xb4" |
| 86 |
"\xc7\x40\xea\x21\x57\x51\x4c\x89\x53\xc0\xd0\xa0\xd4\x42\x6c\x2d" |
| 87 |
"\x53\x26\x75\x3c\x15\x41\xd8\x55\x3c\x1e\xa4\xa8\x93\xa8\x34\x20" |
| 88 |
"\xe4\x30\xd2\x55\x3c\x19\x33\xa8\x99\xcd\x54\xc8\xff\xff\xff\xf2" |
| 89 |
"\xbb\x0d\x49\x92\x6e\xe5\xfa\x53\xc1\x93\x3a\x9e\x0d\x44\x8a\x0e" |
| 90 |
"\xa3\x52\x3a\x11\xf4\xa0\xea\x91\x44\xce\x55\x09\x61\x46\x9b\x6c" |
| 91 |
"\x2a\x14\xf0\x55\x0d\x48\xe6\x35\x45\x50\xf6\xd9\xff\xff\xff\xe2" |
| 92 |
"\x6c\x29\x56\x93\xc1\x68\xa0\xd5\x4c\xa5\x76\x1d\x27\x4f\xaa\xca" |
| 93 |
"\x85\x12\x75\x27\x1f\x72\xa9\x19\x4b\x57\xff\xf6\xff\xff\x37\xff" |
| 94 |
"\xff\x70\xd4\x42\x6c\x2d\x53\x26\x75\x10\x3e\xe3\x98\xbf\x4a\x4a" |
| 95 |
"\x5b\x0e\x43\x1e\xd4\x7d\x28\x3a\x0d\xdc\xbf\xff\xff\xfe\x1a\xa5" |
| 96 |
"\x0c\x94\x16\x89\x7e\x94\x4c\xe5\x50\xa8\x41\x6a\x21\x54\x3c\xaa" |
| 97 |
"\x50\x69\x4a\xa1\xaa\x51\x33\x8d\x2a\x19\x2a\x19\x0a\x26\x72\xa9" |
| 98 |
"\x59\xd2\x5a\x89\xe9\x43\xca\xa5\x27\x49\x8f\x57\xd2\x89\x9c\xbf" |
| 99 |
"\xff\xff\xfe\x16\x82\xd2\x5a\x92\x3a\x14\x42\x6d\x96\x55\x0c\x94" |
| 100 |
"\x16\x89\x54\x3d\xa9\x50\xf2\xa9\xe2\x73\x12\x75\x13\x39\x54\xa4" |
| 101 |
"\x75\x7a\x52\x53\xd9\x4a\x14\x3c\xaa\x50\x69\x4a\xa4\xe3\xee\x55" |
| 102 |
"\x23\x29\x6a\xff\xff\xff\xf2\x93\xdb\x44\x85\x93\xed\x43\x54\xa2" |
| 103 |
"\x27\x3d\x89\xfa\x51\x33\x8d\x2a\x78\x9c\xc4\x9d\x4f\x16\x19\x33" |
| 104 |
"\x95\x0a\x1a\xa5\x13\x39\x54\x8c\xf2\x7a\x50\xf2\xa8\x35\x11\x50" |
| 105 |
"\xfa\x95\x4f\x13\x96\xa5\x13\x39\x7f\xff\xff\xfc\x9c\xa3\x91\x43" |
| 106 |
"\x21\x42\x5a\x95\x0f\x2c\xbf\x4a\x0e\xa9\x14\x4c\xe5\x51\x15\x0f" |
| 107 |
"\xa9\x7e\x94\x1a\x14\x1a\x88\xa8\x7d\x4b\xf4\xa1\x90\xa4\x85\x1c" |
| 108 |
"\x9f\x4a\x1e\xc5\x3c\x4e\x62\x4e\xa5\x06\xaa\x62\xd8\x85\x0d\x57" |
| 109 |
"\xff\xff\xff\x89\x9c\xaa\x22\x71\xd6\x5a\x0a\x84\x29\x45\xb4\xd6" |
| 110 |
"\xa1\xe5\x51\x36\xd8\x9a\x0a\xb5\x25\x1a\x54\x1d\x52\x29\x61\x48" |
| 111 |
"\x73\x50\x85\x07\x54\x8a\x76\xb4\xdd\xcb\x62\x14\x96\xc3\xd2\xa2" |
| 112 |
"\x67\x2a\x95\xd8\x79\x3f\xff\xff\xfc\x3c\xaa\x0d\x49\x4d\x54\xc5" |
| 113 |
"\xb1\x7f\xff\xff\xff\x3f\xff\xff\xfc\xdd\x69\x27\x53\xc0\xd0\xa2" |
| 114 |
"\x67\x2a\x86\xa6\xbb\x0a\x84\x18\xf5\x28\x79\x54\x42\x6c\x2d\x53" |
| 115 |
"\x26\x75\x32\x29\x30\xd3\x39\x6c\x2c\x8a\x4b\x61\xe9\x51\x33\x99" |
| 116 |
"\x0a\x52\x3a\x94\xf1\x39\xd4\xac\x64\x2c\x8a\x5b\x5f\xff\xff\xff" |
| 117 |
"\x83\xaa\x45\x24\x3f\x8a\x97\x51\x4c\x65\x53\xc0\xd0\xa4\xa6\xb2" |
| 118 |
"\x9a\x3d\x29\x5d\x03\xa9\x25\x91\x43\xd4\xa4\xe6\x42\x94\x16\x64" |
| 119 |
"\x7d\xa9\x39\x90\xa4\xa5\x2a\x54\x42\x6c\xb4\x9d\x54\x4c\xe5\x52" |
| 120 |
"\x42\x93\xaf\xff\xff\xff\x88\xed\x68\xec\x2d\x1e\x94\x1d\x52\x29" |
| 121 |
"\xe0\xc9\x9d\x44\x5b\x61\x53\xeb\xed\x42\xf7\x2d\x9e\x94\xa4\xfd" |
| 122 |
"\xcb\x49\x6a\x4a\x87\x95\x41\xa9\x4d\xa8\x25\x05\xfa\x52\x5b\x0f" |
| 123 |
"\x4a\x89\x9c\xaa\x4e\x51\xf7\x2a\x87\x97\xff\xff\xff\xc4\xce\x55" |
| 124 |
"\x11\x39\xed\xa2\x42\xd8\x85\x12\x75\x13\x39\x54\x49\xa6\x9d\x25" |
| 125 |
"\xa8\xd5\x4c\xa1\xe5\x51\x33\x95\x4a\x0d\x5a\x14\x1c\x67\xb5\x2a" |
| 126 |
"\x26\x72\xa8\x43\x4c\x3b\x3e\x94\xf0\x34\x7f\xff\xff\xf9\x21\x48" |
| 127 |
"\x64\x1b\xb9\x7e\x94\x1d\x52\x28\x82\x96\x92\xc8\xa2\x4e\xa1\x0f" |
| 128 |
"\x49\x54\x3d\xa9\x50\xf2\xa8\x35\x10\x9b\x0b\x54\xc9\x9d\x44\xce" |
| 129 |
"\x34\xa9\xe0\x68\x50\xbe\x48\x54\x20\xdd\xca\xa0\xea\x93\xff\xff" |
| 130 |
"\xff\xc3\xf7\x2d\x9e\x27\x2d\x14\x9a\xa9\x97\x51\x4c\x95\x29\x28" |
| 131 |
"\xc8\x9f\xa5\x13\x39\xed\x9a\x75\x13\x39\x90\xa2\x13\x61\x6a\x99" |
| 132 |
"\x33\xa9\x59\x6c\xee\x39\x0b\x22\x85\xee\x5b\x3d\x28\x32\x24\xc7" |
| 133 |
"\xa9\x43\xcb\xff\xff\xff\xe4\xe6\x47\xd2\x86\x4a\x88\x29\x69\x2c" |
| 134 |
"\x8a\x47\x6a\x54\x4c\xe5\x50\x72\x77\x2d\x89\x32\x0b\x49\x6a\x4a" |
| 135 |
"\x87\x95\x41\xa9\x35\x85\x1a\x4b\x62\x88\x4d\x85\xaa\x64\xce\xa2" |
| 136 |
"\x67\x1a\x54\xa2\xdb\x3a\x96\x4f\xff\xff\xff\x3c\x19\x33\x9a\xaf" |
| 137 |
"\xa5\x13\x38\xd2\xa5\x03\xf4\xa4\x87\xb2\x91\xd4\x95\x07\x54\x8a" |
| 138 |
"\x54\x75\x29\x3d\x85\x51\x33\x8e\xa5\x10\x93\x59\x61\x64\x52\x5b" |
| 139 |
"\x0f\x4a\x89\x35\x25\x51\x27\x51\x26\xa4\xbf\x4a\x47\x6a\x7f\xff" |
| 140 |
"\xff\xfc\xf1\x39\x89\x3a\x94\x9a\x69\xd2\xa0\xec\x3d\xa8\x2f\xd2" |
| 141 |
"\x83\x4a\x83\xab\xd2\x94\x9e\x92\xd4\x9f\xa5\x12\x5b\x2c\x34\x74" |
| 142 |
"\x15\x41\xd5\x22\x84\x3d\x35\x96\x8a\x0d\x54\xdf\x4a\x50\x6e\xa5" |
| 143 |
"\x51\x33\x95\x4b\x07\x31\x7f\xff\xff\xfc\x3c\xaa\x0d\x4a\x0c\x7a" |
| 144 |
"\x94\x3d\x8a\x26\x72\xa9\xe2\xc1\xa6\x75\x0f\x2a\x83\x51\x09\x3d" |
| 145 |
"\x94\xaf\xff\xff\xff\xe7\xff\xff\xff\x9b\xe7\x2a\x84\x39\xfa\xa8" |
| 146 |
"\x84\xda\x4e\xaa\x4e\x64\x29\x39\x47\x22\x87\xb5\x2a\x1e\x55\x13" |
| 147 |
"\x39\x54\x98\x74\x50\x5f\x4a\x48\x73\xd8\xa0\xea\x91\x49\xac\x35" |
| 148 |
"\x55\x16\x45\x0b\x51\x0f\x6d\x83\x98\xd5\x4d\x47\xaf\xff\xff\xff" |
| 149 |
"\x06\x95\x29\x2f\xd2\x83\x4a\x89\x9c\xaa\x20\x74\x95\x44\x9a\x92" |
| 150 |
"\xa9\xd0\xb6\x75\x35\x53\x29\x39\x90\xa2\x67\xb6\x98\xd4\x35\x4a" |
| 151 |
"\x26\x72\xa9\x21\xac\x29\x12\x63\xd4\xa1\xe5\x51\x33\x95\x4a\x47" |
| 152 |
"\x52\x9e\x27\x3f\xff\xff\xff\x95\x8c\x85\x91\x4b\x6b\x50\x75\x48" |
| 153 |
"\xa4\x87\xf1\x52\x91\xfa\x51\x33\x95\x49\xc6\x92\x4f\xe0\x7e\x97" |
| 154 |
"\x51\x4d\xf3\xda\x85\x32\x29\xe0\x68\x52\x63\x77\x2d\x4a\x24\xea" |
| 155 |
"\x5b\x54\x85\xb1\x09\x1d\x52\x28\x99\xc6\x9f\xff\xff\xff\x27\x2a" |
| 156 |
"\x9e\x06\x85\x13\x39\x54\x20\xeb\x48\xcd\x57\xd2\x89\x9c\xaa\x7f" |
| 157 |
"\xff\x6f\xff\xf3\x7f\xff\xb3\xaa\x89\x14\xd0\x3a\xbe\xbf\xff\xb7" |
| 158 |
"\xff\xf9\xbf\xff\xf3\x28\x6a\x94\x4c\xe5\x50\x87\x3f\x5f\xff\xed" |
| 159 |
"\xff\xfe\x6f\xff\xee\x21\x4e\xe5\xb2\xa1\x92\xda\x07\x67\xd2\x89" |
| 160 |
"\x9c\xbf\xff\xff\xfe\x1a\xa9\x0d\xdc\xd2\x5a\x3a\x14\xf1\x39\xe9" |
| 161 |
"\x53\x22\x94\xda\x84\xa8\x6a\x92\x5b\x3b\x98\xbe\x14\x1d\x52\x29" |
| 162 |
"\x5d\xa9\x51\x27\x51\x33\x95\x44\xd8\x7b\x63\xa0\xaa\x1e\x55\x10" |
| 163 |
"\x7a\x4b\x39\xfc\x7f\xff\xff\xf9\x31\x52\x93\x55\x32\x94\x95\x41" |
| 164 |
"\xa2\x73\xd8\x55\xd4\x53\x22\x93\x8e\x45\x27\x1d\x12\xa8\x84\x8e" |
| 165 |
"\xc4\x96\x45\x25\x3d\x9e\x07\x64\x9f\x4a\x24\xea\x4c\x54\xa8\x7e" |
| 166 |
"\xe5\xb1\x4f\x06\x4c\xea\x78\x9c\x69\x53\x27\xff\xff\xff\x9e\x06" |
| 167 |
"\x85\x08\x5b\x12\x33\x54\xa7\x83\xdb\x44\x8a\x46\x55\x06\xa2\x12" |
| 168 |
"\x7b\x29\xf4\xa4\xa6\xee\x55\x29\x35\x56\xa4\xa8\xfa\x53\xc4\xe5" |
| 169 |
"\xa9\x41\xa9\x49\xec\x2a\x9d\xcc\x7a\x0b\x52\x7f\xff\xff\xfc\x45" |
| 170 |
"\xb2\xca\x72\x0d\x26\xaa\x65\x2b\x1d\x87\xf3\xe9\x14\xa8\x82\x9b" |
| 171 |
"\xd9\x64\x51\x33\x95\x4b\x6a\x94\xf6\x26\xda\x86\x92\xa9\x59\x6c" |
| 172 |
"\x41\xea\x53\xc4\xe7\x53\xc0\xd0\xa5\x1e\x8d\x54\xca\x1e\xa5\x27" |
| 173 |
"\x32\x3f\xff\xff\xfc\x8c\x64\xea\xba\x8a\x63\x2a\x9e\x2c\x2d\x44" |
| 174 |
"\x9c\xb2\x28\x3a\xa4\x53\xc5\x86\x4c\xe5\x91\x41\xc6\x7b\x52\xa1" |
| 175 |
"\x0f\x57\x7b\x68\x41\xbb\x96\x8f\x4b\xa8\xa6\xf9\xca\xa1\x27\x35" |
| 176 |
"\x5f\x4a\x78\x32\x67\x51\x33\x97\xff\xff\xff\xc9\x07\x4d\x6a\x47" |
| 177 |
"\x40\xc9\xd5\x48\xca\x3b\x24\xfa\x52\xb3\x9a\xa4\x96\x45\x27\x34" |
| 178 |
"\xd3\x96\xc5\x0d\x52\x89\x9c\xaa\x0c\xd6\x28\x34\x28\x99\xca\xa4" |
| 179 |
"\x63\x27\x55\x29\xb5\x04\xa0\xa8\x51\x09\x34\xb2\x96\xa2\xc9\xff" |
| 180 |
"\xff\xff\xe0\xea\x91\x44\xce\x55\x09\x39\x50\x95\x11\xe0\xb4\x50" |
| 181 |
"\x59\x14\x35\x4a\x0e\xa5\x2d\xa8\x87\xa9\x04\x31\xed\x42\x83\xaa" |
| 182 |
"\x45\x0d\x52\x12\x6a\x88\x93\x77\x2a\x85\x96\x53\xd8\x95\x12\x75" |
| 183 |
"\x26\x2a\x7f\xff\xff\xfc\xa4\xf6\x15\x41\x9a\xc5\xd4\x53\x85\x52" |
| 184 |
"\x16\xc5\x13\x39\x54\xf1\x39\x91\xd4\xb6\x23\xe9\x41\xd5\x22\x83" |
| 185 |
"\xa2\x85\x2d\xa9\x05\x2d\x5f\x4a\x64\x53\xad\x45\xf0\xa2\x67\x1a" |
| 186 |
"\x54\x4c\xe5\x51\x1d\x4d\x52\x9e\x06\x8f\xff\xff\xff\x12\x3e\xa6" |
| 187 |
"\xaa\x65\x0f\x52\x83\x52\xbb\x6c\xae\x83\x22\x75\x27\xb4\xab\xff" |
| 188 |
"\xff\xff\xf9\xff\xff\xff\xe6\xf9\xca\xa1\x07\x5a\x46\x6a\xbe\x94" |
| 189 |
"\x3d\x8a\x72\x3d\x12\xa9\x9c\x76\x20\xb5\x7d\x28\x34\x29\x49\x6a" |
| 190 |
"\x50\x83\xa2\x82\xc8\xa4\xe6\xa7\xe9\x42\x14\x68\x2c\x8a\x56\x32" |
| 191 |
"\x1a\xa9\x94\x1d\x52\x29\x30\xfd\x96\x4f\xff\xff\xff\x24\x3f\x8a" |
| 192 |
"\x94\x1a\x54\x4c\xe5\x52\x4f\x46\xaa\x65\x29\x1d\x4b\xa8\xa6\xe3" |
| 193 |
"\xa9\x29\x8b\x61\x0a\xa4\xe3\x91\x44\xce\x64\x29\x29\xaa\x1d\x0a" |
| 194 |
"\x21\x36\x5b\x34\xd4\x15\x48\xca\x43\xd2\x55\x13\x38\xd2\xa2\x67" |
| 195 |
"\x2f\xff\xff\xff\x88\x19\xa8\x3d\x8a\x56\x3b\x50\x59\x14\x35\x4a" |
| 196 |
"\x26\x72\xa8\x32\x25\x43\xca\xa4\xb4\x1a\xa9\x8d\x54\xca\x52\x7b" |
| 197 |
"\x0a\xa7\x81\xa4\xb6\x28\x7e\xe5\xb1\x49\xcd\x4a\x83\xaa\x45\x10" |
| 198 |
"\x91\xd8\x59\x3f\xff\xff\xfc\x25\xb6\x18\xf6\xa2\x8f\x5f\x4a\x26" |
| 199 |
"\x72\xa8\x41\xd5\xdc\x68\x52\x3b\x49\xd4\xa9\x52\xb1\xd8\x9a\x3d" |
| 200 |
"\x28\x93\x50\x92\xc8\xa0\xea\x91\x49\x2c\x35\x75\x9a\xa9\x94\x32" |
| 201 |
"\x50\xa1\x0f\x52\x4b\x52\x50\xa2\x4f\xff\xff\xff\xe2\x67\x2a\x92" |
| 202 |
"\x14\x9d\x57\x51\x4d\xf3\x95\x49\x3d\x1a\xa9\x94\xa4\x75\x29\x19" |
| 203 |
"\x46\x95\x06\xa2\x46\x94\x9c\xea\x1e\xa5\x13\x39\x54\x9c\x69\x24" |
| 204 |
"\xea\x78\x32\x67\x52\x73\x21\x49\xca\x5a\x11\xf5\xff\xff\xff\xe2" |
| 205 |
"\x13\x60\xcd\x34\xe9\x2d\x45\x91\x43\xda\x95\x27\x32\x14\xa0\xb3" |
| 206 |
"\x23\xe9\x41\xd5\x22\x88\x49\xa5\x94\xb5\x16\x45\x0d\x52\x87\xa8" |
| 207 |
"\xaa\x4d\x61\x46\x95\x12\x5a\x90\x55\x0b\x2c\xa7\xb1\x3f\x4a\x0e" |
| 208 |
"\xa9\x3f\xff\xff\xfc\xb0\xf4\x50\x59\x14\x9c\xc8\x52\x72\x8e\x45" |
| 209 |
"\x25\xb0\xf4\xa8\x83\x48\x55\x12\x75\x10\x69\x0a\xba\x8a\x6f\x9c" |
| 210 |
"\xb5\x28\x99\xca\xa5\x36\xa0\x94\x15\x0a\x58\x5a\x07\xe4\xb2\x7d" |
| 211 |
"\x28\x99\xca\xa4\xe5\x1c\x9f\xff\xff\xfe\x21\x27\xae\xb2\xc8\xa5" |
| 212 |
"\x87\xa2\x83\x55\x37\xd2\x83\xaa\x45\x06\xa2\x0d\x34\xff\x4a\x0d" |
| 213 |
"\x0a\x1e\x55\x2b\xb0\xf2\x9e\xda\xa4\x52\xc2\xd0\x62\xcb\xf4\xa4" |
| 214 |
"\xb4\x1c\x69\x2c\x8a\x5b\x5f\x81\xd9\x22\x92\xd8\x7a\x7f\xff\xff" |
| 215 |
"\xfc\x9c\xc8\x52\x83\x56\x85\xd4\x53\x7c\xe5\x53\xa0\xfc\x29\x25" |
| 216 |
"\x87\xae\xb2\xc9\xf4\xa2\x67\x2a\x96\xd7\x59\x6c\x52\x83\x56\xa5" |
| 217 |
"\x06\x95\x25\x93\xe9\x41\xd5\x22\x89\xf0\x75\x2c\x3f\x84\x28\x79" |
| 218 |
"\x7f\xff\xff\xfc\x49\xe3\x19\x08\x75\xa4\x32\x08\x7a\x0f\x6d\x85" |
| 219 |
"\x91\x44\x94\xa9\x9d\x41\xd7\x59\x47\x61\x64\x5d\x45\x32\x25\x44" |
| 220 |
"\x14\xb4\x96\x45\x06\x85\x13\x39\xed\x9a\x75\x27\x32\x14\x94\xa3" |
| 221 |
"\x4d\xb6\x15\x0a\x4e\x39\x3f\xff\xff\xfc\x96\xc3\xfb\x2d\x4a\x1a" |
| 222 |
"\xa4\x9d\x41\xa9\x21\x87\x19\xe8\x31\x07\x42\x93\x58\x6a\x94\x1a" |
| 223 |
"\x54\x4c\xe5\x53\xc1\xec\xa2\x45\x27\x2a\x93\x8e\x45\x28\x2c\xa9" |
| 224 |
"\x50\x75\x48\xa1\xed\x4f\x83\x25\x25\x91\x7f", |
| 225 |
12 + 16 * 174 + 11, |
| 226 |
"Pacing back and forth the length of the hatchways and savagely chewing\n" |
| 227 |
"the end of a cigar, was the man whose casual glance had rescued me from\n" |
| 228 |
"the sea. His height was probably five feet ten inches, or ten and a\n" |
| 229 |
"half; but my first impression, or feel of the man, was not of this, but\n" |
| 230 |
"of his strength. And yet, while he was of massive build, with broad\n" |
| 231 |
"shoulders and deep chest, I could not characterize his strength as\n" |
| 232 |
"massive. It was what might be termed a sinewy, knotty strength, of the\n" |
| 233 |
"kind we ascribe to lean and wiry men, but which, in him, because of his\n" |
| 234 |
"heavy build, partook more of the enlarged gorilla order. Not that in\n" |
| 235 |
"appearance he seemed in the least gorilla-like. What I am striving to\n" |
| 236 |
"express is this strength itself, more as a thing apart from his physical\n" |
| 237 |
"semblance. It was a strength we are wont to associate with things\n" |
| 238 |
"primitive, with wild animals, and the creatures we imagine our\n" |
| 239 |
"tree-dwelling prototypes to have been—a strength savage, ferocious, alive\n" |
| 240 |
"in itself, the essence of life in that it is the potency of motion, the\n" |
| 241 |
"elemental stuff itself out of which the many forms of life have been\n" |
| 242 |
"moulded; in short, that which writhes in the body of a snake when the\n" |
| 243 |
"head is cut off, and the snake, as a snake, is dead, or which lingers in\n" |
| 244 |
"the shapeless lump of turtle-meat and recoils and quivers from the prod\n" |
| 245 |
"of a finger.\n" |
| 246 |
"\n" |
| 247 |
"Such was the impression of strength I gathered from this man who paced up\n" |
| 248 |
"and down. He was firmly planted on his legs; his feet struck the deck\n" |
| 249 |
"squarely and with surety; every movement of a muscle, from the heave of\n" |
| 250 |
"the shoulders to the tightening of the lips about the cigar, was\n" |
| 251 |
"decisive, and seemed to come out of a strength that was excessive and\n" |
| 252 |
"overwhelming. In fact, though this strength pervaded every action of\n" |
| 253 |
"his, it seemed but the advertisement of a greater strength that lurked\n" |
| 254 |
"within, that lay dormant and no more than stirred from time to time, but\n" |
| 255 |
"which might arouse, at any moment, terrible and compelling, like the rage\n" |
| 256 |
"of a lion or the wrath of a storm.\n" |
| 257 |
"\n" |
| 258 |
"The cook stuck his head out of the galley door and grinned encouragingly\n" |
| 259 |
"at me, at the same time jerking his thumb in the direction of the man who\n" |
| 260 |
"paced up and down by the hatchway. Thus I was given to understand that\n" |
| 261 |
"he was the captain, the “Old Man,” in the cook’s vernacular, the\n" |
| 262 |
"individual whom I must interview and put to the trouble of somehow\n" |
| 263 |
"getting me ashore. I had half started forward, to get over with what I\n" |
| 264 |
"was certain would be a stormy five minutes, when a more violent\n" |
| 265 |
"suffocating paroxysm seized the unfortunate person who was lying on his\n" |
| 266 |
"back. He wrenched and writhed about convulsively. The chin, with the\n" |
| 267 |
"damp black beard, pointed higher in the air as the back muscles stiffened\n" |
| 268 |
"and the chest swelled in an unconscious and instinctive effort to get\n" |
| 269 |
"more air. Under the whiskers, and all unseen, I knew that the skin was\n" |
| 270 |
"taking on a purplish hue.\n" |
| 271 |
"\n" |
| 272 |
"The captain, or Wolf Larsen, as men called him, ceased pacing and gazed\n" |
| 273 |
"down at the dying man. So fierce had this final struggle become that the\n" |
| 274 |
"sailor paused in the act of flinging more water over him and stared\n" |
| 275 |
"curiously, the canvas bucket partly tilted and dripping its contents to\n" |
| 276 |
"the deck. The dying man beat a tattoo on the hatch with his heels,\n" |
| 277 |
"straightened out his legs, and stiffened in one great tense effort, and\n" |
| 278 |
"rolled his head from side to side. Then the muscles relaxed, the head\n" |
| 279 |
"stopped rolling, and a sigh, as of profound relief, floated upward from\n" |
| 280 |
"his lips. The jaw dropped, the upper lip lifted, and two rows of\n" |
| 281 |
"tobacco-discoloured teeth appeared. It seemed as though his features had\n" |
| 282 |
"frozen into a diabolical grin at the world he had left and outwitted.", |
| 283 |
3687, |
| 284 |
}, |
| 285 |
{ __LINE__, |
| 286 |
(unsigned char *) |
| 287 |
"\xe5\x39\x6a\x50\xd5\x28\x99\xca\xa5\xe3\xdb\x62" |
| 288 |
"\x0a\xa1\xe5\x52\x7b\x69\x1d\x4a\x17\xb9\x6a\x4a\x14\x32\x54\x8c" |
| 289 |
"\xa4\x3d\x25\x42\x95\x14\x85\x42\x07\x67\xa5\x25\x3d\x8a\x1e\xa2" |
| 290 |
"\xa9\x59\x4f\x5d\x05\x51\x27\x52\x43\x21\x07\xa3\xb9\x54\x4c\xe5" |
| 291 |
"\x52\xb3\xd0\x64\x98\x83\xa1\x48\xc7\x54\x88\x53\xc4\xe6\x24\xea" |
| 292 |
"\x4e\x3e\xe5\x50\x87\xaa\xa2\x91\x25\x91\x44\xce\x5a\x54\xf0\x64" |
| 293 |
"\xce\xa0\xea\x3a\x67\x2d\x8a\x0e\xa9\x14\x49\xd4\x1a\x11\x6d\x25" |
| 294 |
"\x50\x74\x9e\xa9\x94\x4c\xe5\x52\xb3\xf8\x2d\x88\x50\xf2\xa8\x99" |
| 295 |
"\xca\xa1\x47\x62\x67\xfa\x51\x33\x95\x44\x16\xb1\xd8\x34\x95\x41" |
| 296 |
"\xd5\x22\x85\xed\x68\xe8\x51\x09\x1a\x4c\x7a\x94\x49\xd4\xf1\x39" |
| 297 |
"\x89\x3a\x89\x9c\xaa\x67\x1f\x84\x28\x79\x54\xd2\x34\xdb\x61\x54" |
| 298 |
"\x1d\x52\x28\x79\x54\xd2\x34\xdb\x61\x7f\xd2\x14\xc4\x79\x14\x2d" |
| 299 |
"\x49\x32\x68\x2a\x89\x9c\xb4\xfd\x28\x35\x24\x29\x0b\x52\x54\xb0" |
| 300 |
"\xa8\xac\xa4\x4a\x89\x3a\x89\x9c\xaa\x1e\xb3\x54\x63\xd4\x85\x0f" |
| 301 |
"\x2a\x94\x8e\xae\xa6\xaa\x45\x2c\x2f\x6b\x4d\x61\x50\xa2\x67\x1a" |
| 302 |
"\x54\x4c\xe5\xf4\xa2\x27\x3d\xb4\x48\xa4\x85\x25\x03\xb0\xaa\x26" |
| 303 |
"\x72\xa8\x41\xda\x82\xa1\x4f\x13\x98\x93\xa8\x6a\x6b\x2d\x0a\x26" |
| 304 |
"\x72\xd2\xa2\x4e\xa2\x67\x2a\x88\x2d\x63\xb0\x69\x31\xea\x5f", |
| 305 |
12 + 16 * 16 + 15, |
| 306 |
"When in the Course of human events it becomes necessary for one " |
| 307 |
"people to dissolve the political bands which have connected them " |
| 308 |
"with another and to assume among the powers of the earth, the " |
| 309 |
"separate and equal station to which the Laws of Nature and of " |
| 310 |
"Nature's God entitle them, a decent respect to the opinions of " |
| 311 |
"mankind requires that they should declare the causes which impel " |
| 312 |
"them to the separation.", |
| 313 |
404, |
| 314 |
}, |
| 315 |
}; |
| 316 |
|
| 317 |
void |
| 318 |
run_test (const struct test_huff_dec *test) |
| 319 |
{ |
| 320 |
struct huff_decode_retval retval; |
| 321 |
struct lsqpack_huff_decode_state state; |
| 322 |
unsigned in_chunk_sz, out_chunk_sz, in_off, out_off, n_to_read, n_to_write; |
| 323 |
char output[0x1000]; |
| 324 |
|
| 325 |
if (verbose) |
| 326 |
fprintf(stderr, "Run test on line %u\n", test->lineno); |
| 327 |
|
| 328 |
for (in_chunk_sz = 1; in_chunk_sz <= test->src_sz; ++in_chunk_sz) |
| 329 |
{ |
| 330 |
if (verbose) |
| 331 |
fprintf(stderr, "chunk %u out of %zu\n", in_chunk_sz, test->src_sz); |
| 332 |
for (out_chunk_sz = 1; out_chunk_sz <= test->dst_sz; ++out_chunk_sz) |
| 333 |
{ |
| 334 |
in_off = 0; |
| 335 |
out_off = 0; |
| 336 |
state.resume = 0; |
| 337 |
n_to_read = MIN(test->src_sz, in_chunk_sz); |
| 338 |
n_to_write = MIN(test->dst_sz, out_chunk_sz); |
| 339 |
|
| 340 |
do |
| 341 |
{ |
| 342 |
assert(in_off + n_to_read <= test->src_sz); /* self-test */ |
| 343 |
retval = lsqpack_huff_decode_full(test->src + in_off, n_to_read, |
| 344 |
(unsigned char *) output + out_off, n_to_write, &state, |
| 345 |
test->src_sz == in_off + n_to_read); |
| 346 |
switch (retval.status) |
| 347 |
{ |
| 348 |
case HUFF_DEC_OK: |
| 349 |
in_off += retval.n_src; |
| 350 |
out_off += retval.n_dst; |
| 351 |
assert(test->dst_sz == out_off); |
| 352 |
assert(test->src_sz == in_off); |
| 353 |
assert(0 == memcmp(test->dst, output, out_off)); |
| 354 |
break; |
| 355 |
case HUFF_DEC_END_SRC: |
| 356 |
case HUFF_DEC_END_DST: |
| 357 |
in_off += retval.n_src; |
| 358 |
out_off += retval.n_dst; |
| 359 |
n_to_write = MIN(sizeof(output) - out_off, out_chunk_sz); |
| 360 |
n_to_read = MIN(test->src_sz - in_off, in_chunk_sz); |
| 361 |
break; |
| 362 |
default: |
| 363 |
assert(retval.status == HUFF_DEC_ERROR); |
| 364 |
assert(0); |
| 365 |
} |
| 366 |
} |
| 367 |
while (in_off < test->src_sz); |
| 368 |
assert(retval.status == HUFF_DEC_OK); |
| 369 |
} |
| 370 |
} |
| 371 |
} |
| 372 |
|
| 373 |
int |
| 374 |
main (int argc, char **argv) |
| 375 |
{ |
| 376 |
const struct test_huff_dec *test; |
| 377 |
int opt, run_expensive = 0; |
| 378 |
|
| 379 |
while (-1 != (opt = getopt(argc, argv, "ve"))) |
| 380 |
{ |
| 381 |
switch (opt) |
| 382 |
{ |
| 383 |
case 'v': |
| 384 |
verbose = 1; |
| 385 |
break; |
| 386 |
case 'e': |
| 387 |
run_expensive = 1; |
| 388 |
break; |
| 389 |
default: |
| 390 |
exit(EXIT_FAILURE); |
| 391 |
} |
| 392 |
} |
| 393 |
|
| 394 |
for (test = tests; test < tests + sizeof(tests) / sizeof(tests[0]); ++test) |
| 395 |
if (run_expensive || test->src_sz * test->dst_sz < 150000) |
| 396 |
run_test(test); |
| 397 |
|
| 398 |
return 0; |
| 399 |
} |