3 #include "lib/fastbuf.h"
4 #include "lib/lizzard.h"
10 static char *options = CF_SHORT_OPTS "cdt";
11 static char *help = "\
12 Usage: lizzard-test <options> input-file [output-file]\n\
16 "-c\t\tCompress (default)\n\
18 -t\t\tCompress, decompress, and compare (in memory only)\n\
29 main(int argc, char **argv)
34 while ((opt = cf_getopt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0)
45 if (action == 't' && argc != optind+1
46 || action != 't' && argc != optind+2)
53 stat(argv[optind], &st);
55 struct fastbuf *fi = bopen(argv[optind], O_RDONLY, 1<<16);
58 lo = li * LIZZARD_MAX_MULTIPLY + LIZZARD_MAX_ADD;
59 li += LIZZARD_NEEDS_CHARS;
68 li = bread(fi, mi, li);
73 printf("->expected %d ", lo);
76 lo = lizzard_compress(mi, li, mo);
78 lo = lizzard_decompress(mi, mo);
84 struct fastbuf *fo = bopen(argv[optind+1], O_CREAT | O_TRUNC | O_WRONLY, 1<<16);
95 lv = lizzard_decompress(mo, mv);
98 if (lv != li || memcmp(mi, mv, lv))