fork/slippc

git clone https://git.julia.blue/fork/slippc

Patrick Crainfixed rare memory leak in parser; updated changelog and readmes for version 0.8.0b79f91c

master
20.6 KiB501 linesraw
1#include "tests.h"
2
3// file containing test replays
4static const std::string TESTDIR       = "test-replays";
5// normal replays
6static const std::string STANDARDDIR   = "standard";
7// replays that cannot compress
8static const std::string CORRUPTDIR    = "corrupt";
9// replays that were compressed with old versions of compressor
10static const std::string BACKCOMPATDIR = "zlp-compat-1";
11
12// known file 1
13static const std::string TSLPFILE      = "3-9-0-singles-irl-summit12.slp.xz";
14// known file 2
15static const std::string TCMPFILE      = "3-7-0-singles-net.slp.xz";
16// temporary slp file
17static const std::string TZLPFILE      = "zlptest.zlp";
18// temporary zlp file
19static const std::string TUNZLPFILE    = "zlptest.slp";
20
21static const std::string tmpzlp        = (PATH(TESTDIR) / PATH(TZLPFILE)).string();
22static const std::string tmpunzlp      = (PATH(TESTDIR) / PATH(TUNZLPFILE)).string();
23
24typedef std::filesystem::directory_iterator f_iter;
25typedef std::filesystem::directory_entry    f_entry;
26
27static int _debug = 0;
28
29namespace slip {
30
31// https://stackoverflow.com/questions/865668/how-to-parse-command-line-arguments-in-c
32char* getCmdOption(char ** begin, char ** end, const std::string & option) {
33  char ** itr = std::find(begin, end, option);
34  if (itr != end && ++itr != end) {
35    return *itr;
36  }
37  return 0;
38}
39
40bool cmdOptionExists(char** begin, char** end, const std::string& option) {
41  return std::find(begin, end, option) != end;
42}
43
44void printUsage() {
45  std::cout
46    << "Usage: slippc-tests [-t <testlevel] [-d <debuglevel]:" << std::endl
47    // << "  -i        Parse and analyze <infile> (not very useful on its own)" << std::endl
48    // << "  -j        Output <infile> in .json format to <jsonfile> (use \"-\" for stdout)" << std::endl
49    // << "  -a        Output an analysis of <infile> in .json format to <analysisfile> (use \"-\" for stdout)" << std::endl
50    // << "  -f        When used with -j <jsonfile>, write full frame info (instead of just frame deltas)" << std::endl
51    // << "  -x        Compress or decompress a replay" << std::endl
52    // << "  -X        Set output file name for compression" << std::endl
53    // << std::endl
54    // << "Debug options:" << std::endl
55    << "  -t        Run tests at level <testlevel>" << std::endl
56    << "  -d        Run debug at level <debuglevel>" << std::endl
57    // << "  --raw-enc Output raw encodes with -x (DANGEROUS, debug only)" << std::endl
58    // << "  -h        Show this help message" << std::endl
59    ;
60}
61
62void testTester() {
63  TSUITE("Basic Pass");
64    ASSERT("Pass 1",1==1,
65      1 << " != " << 1);
66    ASSERT("Pass 2",1!=2,
67      1 << " == " << 2);
68    ASSERT("Pass 3",2==2,
69      2 << " != " << 2);
70  TSUITE("Basic Assert");
71    ASSERT("Pass",1==1,
72      1 << " != " << 1);
73    ASSERT("Fail",1==2,
74      1 << " != " << 2);
75    ASSERT("Fail 2",2!=2,
76      2 << " == " << 2);
77  TSUITE("Basic Suggest");
78    SUGGEST("Suggest Pass",1==1,
79      1 << " != " << 1);
80    SUGGEST("Suggest Fail",1==2,
81      1 << " != " << 2);
82  TSUITE("Basic Both");
83    SUGGEST("Both Pass",1==1,
84      1 << " != " << 1);
85    SUGGEST("Both Warn",1==2,
86      1 << " != " << 2);
87    ASSERT("Both Fail",1==2,
88      1 << " != " << 2);
89  TSUITE("All Fail");
90    ASSERT("All Fail 1",1!=1,
91      1 << " == " << 1);
92    ASSERT("All Fail 2",2!=2,
93      2 << " == " << 2);
94  TSUITE("Vars");
95    int x = 1, y = 1, z = 2;
96    ASSERT("Var Pass 1",x==y,
97      x << " == " << y);
98    ASSERT("Var Fail 1",x!=y,
99      x << " == " << y);
100    ASSERT("Var Fail 2",x==z,
101      x << " != " << z);
102  TSUITE("Errors");
103    ASSERT("Error 1",[](){throw std::logic_error("Error Test"); return true;}(),
104    "1/0");
105}
106
107int testTestFiles() {
108  // TSUITE("Files Available");
109  return 0;
110}
111
112int sanityCheck(slip::Parser *p, std::string name, std::string path) {
113  ASSERT(name+" Exists",access( path.c_str(), F_OK ) == 0,
114        name << " does not exist");
115  BAILONFAIL(1);
116  ASSERT(name+" Parses",p->load(path.c_str()),
117    name << " does not parse");
118    BAILONFAIL(1);
119
120  const SlippiReplay* r = p->replay();
121  ASSERT("  First frame is -123",r->first_frame == -123,
122    name+" first frame is " << r->first_frame);
123  int playing = -1;
124  for(unsigned i = 0; i < 8; ++i) {
125    int pt = r->player[i].player_type;
126    ASSERT("  Port "+std::to_string(i)+" player type < 4",pt < 4,
127      "Port "<<i<<" player type is "<<pt);
128    if(pt < 3) {
129      playing = i;
130    }
131  }
132  ASSERT("  Game has at least 1 player",playing >= 0,
133    "Game has no players");
134  BAILONFAIL(1);
135
136  for(unsigned pnum = 0; pnum < 8; ++pnum) {
137    if (r->player[pnum].player_type == 3) {
138      continue;
139    }
140    unsigned flag_char = 0, flag_jumps = 0, flag_dmg = 0, flag_shield = 0,
141      flag_lcancel = 0, flag_hurt = 0, flag_stocks = 0, flag_stocks_inc = 0;
142    unsigned char cid = r->player[pnum].frame[0].char_id;
143    bool sheik = ((cid == 7) || (cid == 19));
144    for(unsigned f = 1; f < r->frame_count; ++f) {
145      SlippiFrame sf = r->player[pnum].frame[f];
146      if (sf.action_post > Action::Sleep) {  //if we're not dead
147        if (sf.char_id != cid) {
148          if(!(sheik && (sf.char_id == 7 || sf.char_id == 19))) {
149            ++flag_char;
150          }
151        }
152      }
153      if (sf.jumps > 6) {
154        ++flag_jumps;
155      }
156      if ((sf.percent_pre > 1000) || (sf.percent_pre < 0)) {
157        ++flag_dmg;
158      }
159      if (sf.shield >= 61) {
160        ++flag_shield;
161      }
162      if (sf.l_cancel > 2) {
163        ++flag_lcancel;
164      }
165      if (sf.hurt_by > 8) {
166        ++flag_hurt;
167      }
168      if (sf.stocks > 99) {
169        ++flag_stocks;
170      }
171    }
172    std::string ps = std::to_string(pnum+1);
173    ASSERT("  Port " + ps + " character is consistent throughout game",flag_char==0,
174      ps << "'s character changes throughout the game");
175    ASSERT("  Port " + ps + " character never has more than 6 jumps",flag_jumps==0,
176      ps << " has more than 6 jumps");
177    ASSERT("  Port " + ps + " damage is always between 0 and 1000",flag_dmg==0,
178      ps << " has weird damage");
179    ASSERT("  Port " + ps + " shield is always <= 60",flag_shield==0,
180      ps << " has more than 60 shield");
181    ASSERT("  Port " + ps + " l cancel status is always <= 2",flag_lcancel==0,
182      ps << "'s l cancel status is more than 2");
183    ASSERT("  Port " + ps + " hurt by player id always < 8",flag_hurt==0,
184      ps << "'s hurt by player >= 8");
185    ASSERT("  Port " + ps + " stocks always <= 99",flag_stocks==0,
186      ps << "'s stocks > 99");
187  }
188
189  return 0;
190}
191
192int testCorruptFiles() {
193  TSUITE("Corrupt File Sanity Checks");
194    int errors = 0;
195    for (const f_entry & entry : f_iter(PATH(TESTDIR) / PATH(CORRUPTDIR))) {
196      std::string path = entry.path().string();
197      std::string name = entry.path().stem().string();
198    // for(unsigned i = 0; i < ncomps; ++i) {
199      slip::Parser *p = new slip::Parser(_debug);
200      if(sanityCheck(p,name,path) != 0) {
201        ++errors;
202      }
203      delete p;
204      slip::Compressor *c = new slip::Compressor(_debug);
205      bool loaded = c->loadFromFile(path.c_str());
206      ASSERTNOERR("Compressor refuses to compress "+name,!loaded,
207        "Compressor attempted to compress corrupt file " << name);
208      delete c;
209    };
210  return 0;
211}
212
213int testConsistencySanity() {
214  TSUITE("Parser Sanity Checks");
215    int errors = 0;
216    for (const f_entry & entry : f_iter(PATH(TESTDIR) / PATH(STANDARDDIR))) {
217      std::string path = entry.path().string();
218      std::string name = entry.path().stem().string();
219    // for(unsigned i = 0; i < ncomps; ++i) {
220      slip::Parser *p = new slip::Parser(_debug);
221      if(sanityCheck(p,name,path) != 0) {
222        ++errors;
223      }
224      delete p;
225    };
226  return 0;
227}
228
229
230int testKnownFiles() {
231  std::string known1 = (PATH(TESTDIR) / PATH(STANDARDDIR) / PATH(TSLPFILE)).string();
232  std::string known2 = (PATH(TESTDIR) / PATH(STANDARDDIR) / PATH(TCMPFILE)).string();
233  slip::Parser *p;
234
235  TSUITE("Known File Parsing");
236    ASSERT("File Exists",access( known1.c_str(), F_OK ) == 0,
237      "File " << known1 << " does not exist");
238    BAILONFAIL(1);
239    std::string test_md5 = md5compressed(known1);
240    ASSERT("MD5 of file is 8ba0485603d5d99cdfd8cead63ba6c1f",test_md5.compare("8ba0485603d5d99cdfd8cead63ba6c1f") == 0,
241      "MD5 of file is " << test_md5);
242    BAILONFAIL(1);
243    p = new slip::Parser(_debug);
244    ASSERT("File Parses",p->load((known1).c_str()),
245      "File does not parse");
246    BAILONFAIL(1);
247    const SlippiReplay* r = p->replay();
248    ASSERT("File version is 3.9.0",r->slippi_version.compare("3.9.0") == 0,
249      "File version is " << r->slippi_version);
250    ASSERT("First frame is -123",r->first_frame == -123,
251      "First frame is " << r->first_frame);
252    ASSERT("Frame count is 13662",r->frame_count == 13662,
253      "Frame count is " << r->frame_count);
254    ASSERT("Seed is 3969935363",r->seed == 3969935363,
255      "Seed is " << r->seed);
256    ASSERT("Played on Nintendont",r->played_on.compare("nintendont") == 0,
257      "Game played on " << r->played_on);
258    ASSERT("Played on date 2021-12-13T10:55:05",r->start_time.compare("2021-12-13T10:55:05") == 0,
259      "Game played on date " << r->start_time);
260    ASSERT("Port 1 is empty",r->player[0].player_type == 3,
261      "Port 1 is not empty");
262    ASSERT("Port 2 is empty",r->player[1].player_type == 3,
263      "Port 2 is not empty");
264    ASSERT("Port 3 played Fox",r->player[2].ext_char_id == 2,
265      "Port 3 played " << r->player[2].ext_char_id << " (" << CharExt::name[r->player[2].ext_char_id] << ")");
266    ASSERT("Port 4 played Marth",r->player[3].ext_char_id == 9,
267      "Port 4 played " << r->player[3].ext_char_id << " (" << CharExt::name[r->player[3].ext_char_id] << ")");
268    ASSERT("Game played on Dream Land",r->stage == 28,
269      "Game played on" << r->stage << " (" << Stage::name[r->stage] << ")");
270    ASSERT("Port 3's damage on frame 2345 = 9.4%",NEAR(r->player[2].frame[2345].percent_post,9.4f),
271      "Port 3's damage on frame 2345 = " << r->player[2].frame[2345].percent_post);
272    ASSERT("Port 4's damage on frame 2345 = 117.46%",NEAR(r->player[3].frame[2345].percent_post,117.46f),
273      "Port 4's damage on frame 2345 = " << r->player[3].frame[2345].percent_post);
274    ASSERT("Port 3's joystick x on frame 4444 = -0.975",NEAR(r->player[2].frame[4444].joy_x,-0.975f),
275      "Port 3's joystick x on frame 4444 = " << r->player[2].frame[4444].joy_x);
276    ASSERT("Port 4's joystick y on frame 4444 = 0",NEAR(r->player[3].frame[4444].joy_y,0.0f),
277      "Port 4's joystick y on frame 4444 = " << r->player[3].frame[4444].joy_y);
278    ASSERT("Port 3's y pos on frame 4444 = 0.0089",NEAR(r->player[2].frame[4444].pos_y_post,0.0089f),
279      "Port 3's y pos on frame 4444 = " << r->player[2].frame[4444].pos_y_post);
280    ASSERT("Port 4's x pos on frame 4444 = 0.0089",NEAR(r->player[3].frame[4444].pos_x_post,-22.0653),
281      "Port 4's x pos on frame 4444 = " << r->player[3].frame[4444].pos_x_post);
282    ASSERT("Port 3 has 3 stocks on frame 4444",r->player[2].frame[4444].stocks == 3,
283      "Port 3 has " << r->player[2].frame[4444].stocks << " stocks on frame 4444");
284    ASSERT("Port 4 has 3 stocks on frame 4444",r->player[3].frame[4444].stocks == 3,
285      "Port 4 has " << r->player[3].frame[4444].stocks << " stocks on frame 4444");
286    ASSERT("Port 3 is in action 'Turn' on frame 5000",r->player[2].frame[5000].action_post == 18,
287      "Port 3 is in action " << r->player[2].frame[5000].action_post << " = " << Action::name[r->player[2].frame[5000].action_post]);
288    ASSERT("Port 3 is in action 'DamageFlyLw' on frame 6000",r->player[2].frame[6000].action_post == 89,
289      "Port 3 is in action " << r->player[2].frame[6000].action_post << " = " << Action::name[r->player[2].frame[6000].action_post]);
290    ASSERT("Port 3 is in action 'DamageFlyRoll' on frame 7000",r->player[2].frame[7000].action_post == 91,
291      "Port 3 is in action " << r->player[2].frame[7000].action_post << " = " << Action::name[r->player[2].frame[7000].action_post]);
292    ASSERT("Port 3 is in action 'Catch' on frame 8000",r->player[2].frame[8000].action_post == 212,
293      "Port 3 is in action " << r->player[2].frame[8000].action_post << " = " << Action::name[r->player[2].frame[8000].action_post]);
294    ASSERT("Port 3 is in action 'AttackAirN' on frame 9000",r->player[2].frame[9000].action_post == 65,
295      "Port 3 is in action " << r->player[2].frame[9000].action_post << " = " << Action::name[r->player[2].frame[9000].action_post]);
296    ASSERT("Port 3 is in action 'EscapeN' on frame 10000",r->player[2].frame[10000].action_post == 350,
297      "Port 3 is in action " << r->player[2].frame[10000].action_post << " = " << Action::name[r->player[2].frame[10000].action_post]);
298    ASSERT("Port 4 is in action 'Fall' on frame 5000",r->player[3].frame[5000].action_post == 29,
299      "Port 4 is in action " << r->player[3].frame[5000].action_post << " = " << Action::name[r->player[3].frame[5000].action_post]);
300    ASSERT("Port 4 is in action 'AttackAirF' on frame 6000",r->player[3].frame[6000].action_post == 66,
301      "Port 4 is in action " << r->player[3].frame[6000].action_post << " = " << Action::name[r->player[3].frame[6000].action_post]);
302    ASSERT("Port 4 is in action 'KneeBend' on frame 7000",r->player[3].frame[7000].action_post == 24,
303      "Port 4 is in action " << r->player[3].frame[7000].action_post << " = " << Action::name[r->player[3].frame[7000].action_post]);
304    ASSERT("Port 4 is in action 'JumpF' on frame 8000",r->player[3].frame[8000].action_post == 25,
305      "Port 4 is in action " << r->player[3].frame[8000].action_post << " = " << Action::name[r->player[3].frame[8000].action_post]);
306    ASSERT("Port 4 is in action 'GuardSetOff' on frame 9000",r->player[3].frame[9000].action_post == 181,
307      "Port 4 is in action " << r->player[3].frame[9000].action_post << " = " << Action::name[r->player[3].frame[9000].action_post]);
308    ASSERT("Port 4 is in action 'JumpF' on frame 10000",r->player[3].frame[10000].action_post == 25,
309      "Port 4 is in action " << r->player[3].frame[10000].action_post << " = " << Action::name[r->player[3].frame[10000].action_post]);
310    delete p;
311
312  TSUITE("Known File Compression");
313    //Removing existing temporary zlp and slp files
314    if (fileExists(tmpzlp.c_str())) {
315      remove(tmpzlp.c_str());
316    }
317    if (fileExists(tmpunzlp.c_str())) {
318      remove(tmpunzlp.c_str());
319    }
320    ASSERT("Uncompressed File Exists",access( known2.c_str(), F_OK ) == 0,
321      "File does not exist");
322    BAILONFAIL(1);
323    std::string test_md5_2 = md5compressed(known2);
324    ASSERT("MD5 of uncompressed file is 7ea1aa5b49f87ab77a66bd8541810d50",test_md5_2.compare("7ea1aa5b49f87ab77a66bd8541810d50") == 0,
325      "MD5 of file is " << test_md5_2);
326    BAILONFAIL(1);
327    slip::Compressor *c = new slip::Compressor(_debug);
328    c->setOutputFilename(tmpzlp.c_str());
329    bool loaded = c->loadFromFile(known2.c_str());
330    ASSERTNOERR("Compressor Loads File",loaded,
331      "Compressor failed to load known file");
332    BAILONFAIL(1);
333    ASSERT("Compressor Validates File",c->validate(),
334      "Compressor failed to validate known file");
335    BAILONFAIL(1);
336    c->saveToFile(false);
337    ASSERT("Compressed File is Generated",access( tmpzlp.c_str(), F_OK ) == 0,
338      "Compressor failed to save compressed output file");
339    BAILONFAIL(1);
340    delete c;
341
342    std::string test_md5_z = md5file(tmpzlp.c_str());
343    SUGGEST("MD5 of compressed file is 8af440882c30c4ac29b935ae3d588e03",test_md5_z.compare("8af440882c30c4ac29b935ae3d588e03") == 0,
344      "MD5 of file is " << test_md5_z << ", compression algorithm may have changed");
345
346    c = new slip::Compressor(_debug);
347    ASSERT("Compressor Loads Compressed File",c->loadFromFile(tmpzlp.c_str()),
348      "Compressor failed to load compressed known file");
349    BAILONFAIL(1);
350    ASSERT("Compressor Validates Compressed File",c->validate(),
351      "Compressor failed to validate compressed known file");
352    BAILONFAIL(1);
353    c->saveToFile(false);
354    ASSERT("In-place decompressed File is Generated",access( tmpunzlp.c_str(), F_OK ) == 0,
355      "Compressor failed to save decompressed output file");
356    BAILONFAIL(1);
357    delete c;
358
359    std::string test_md5_3 = md5file(tmpunzlp.c_str());
360    ASSERT("MD5 of restored file is 7ea1aa5b49f87ab77a66bd8541810d50",test_md5_3.compare("7ea1aa5b49f87ab77a66bd8541810d50") == 0,
361      "MD5 of restored file is " << test_md5_3);
362
363  return 0;
364}
365
366int testCompressionBackcompat() {
367  TSUITE("Backwards Compatible Decompression");
368    for (const f_entry & entry : f_iter(PATH(TESTDIR) / PATH(BACKCOMPATDIR))) {
369      std::string path        = entry.path().string();
370      std::string name        = entry.path().stem().string();
371      // md5 checksum is first 32 characters of filename
372      std::string test_md5_o  = name.substr(0,32);
373      // base name is rest of filename
374      name                    = name.substr(33,name.length()-33);
375
376      //Removing existing temporary zlp and slp files
377      if (fileExists(tmpunzlp.c_str())) {
378        remove(tmpunzlp.c_str());
379      }
380
381      ASSERT(name+".zlp Exists",access( path.c_str(), F_OK ) == 0,
382        name << " does not exist");
383      BAILONFAIL(1);
384
385      slip::Compressor *c = new slip::Compressor(_debug);
386      c->setOutputFilename(tmpunzlp.c_str());
387      bool loaded = c->loadFromFile(path.c_str());
388      ASSERTNOERR("Decompressor Loads "+name,loaded,
389        "Decompressor failed to load " << name);
390      BAILONFAIL(1);
391      ASSERT("Compressor Validates "+name,c->validate(),
392        "Decompressor failed to validate " << name);
393      BAILONFAIL(1);
394      c->saveToFile(false);
395      ASSERT("Compressed File for "+name+" is Generated",access( tmpunzlp.c_str(), F_OK ) == 0,
396        "Decompressor failed to save compressed output file for " << name);
397      BAILONFAIL(1);
398      delete c;
399
400      std::string test_md5_r = md5file(tmpunzlp.c_str());
401      ASSERT("MD5 of restored file for "+name+" is "+test_md5_o,test_md5_r.compare(test_md5_o) == 0,
402        "MD5 of restored file for " << name << " is " << test_md5_r);
403    }
404    return 0;
405}
406
407int testCompressionVersions() {
408  slip::Compressor *c;
409  TSUITE("All Version Compression");
410    for (const f_entry & entry : f_iter(PATH(TESTDIR) / PATH(STANDARDDIR))) {
411      std::string path = entry.path().string();
412      std::string name = entry.path().stem().string();
413      //Removing existing temporary zlp and slp files
414      if (fileExists(tmpzlp.c_str())) {
415        remove(tmpzlp.c_str());
416      }
417      if (fileExists(tmpunzlp.c_str())) {
418        remove(tmpunzlp.c_str());
419      }
420      ASSERT(name+" Exists",access( path.c_str(), F_OK ) == 0,
421        name << " does not exist");
422      NEXTONFAIL();
423      std::string test_md5_o = md5compressed(path);
424
425      c = new slip::Compressor(_debug);
426      c->setOutputFilename(tmpzlp.c_str());
427      bool loaded = c->loadFromFile((path).c_str());
428      ASSERTNOERR("Compressor Loads "+name,loaded,
429        "Compressor failed to load " << name);
430      NEXTONFAIL();
431      ASSERT("Compressor Validates "+name,c->validate(),
432        "Compressor failed to validate " << name);
433      NEXTONFAIL();
434      c->saveToFile(false);
435      ASSERT("Compressed File for "+name+" is Generated",access( tmpzlp.c_str(), F_OK ) == 0,
436        "Compressor failed to save compressed output file for " << name);
437      NEXTONFAIL();
438      delete c;
439
440      c = new slip::Compressor(_debug);
441      ASSERT("Compressor Loads Compressed "+name,c->loadFromFile(tmpzlp.c_str()),
442        "Compressor failed to load compressed " << name);
443      BAILONFAIL(1);
444      ASSERT("Compressor Validates Compressed "+name,c->validate(),
445        "Compressor failed to validate compressed " << name);
446      BAILONFAIL(1);
447      c->saveToFile(false);
448      ASSERT("In-place Decompressed File is Generated for "+name,access( tmpunzlp.c_str(), F_OK ) == 0,
449        "Compressor failed to save decompressed output file for " << name);
450      BAILONFAIL(1);
451      delete c;
452
453      std::string test_md5_r = md5file(tmpunzlp.c_str());
454      ASSERT("MD5 of restored file for "+name+" is "+test_md5_o,test_md5_r.compare(test_md5_o) == 0,
455        "MD5 of restored file for " << name << " is " << test_md5_r);
456    }
457  return 0;
458}
459
460int runtests(int argc, char** argv) {
461  if (cmdOptionExists(argv, argv+argc, "-h")) {
462    printUsage();
463    return 0;
464  }
465
466  char* dlevel       = getCmdOption(   argv, argv+argc, "-d");
467  char* tlevel       = getCmdOption(   argv, argv+argc, "-t");
468  if (dlevel) {
469    if (dlevel[0] >= '0' && dlevel[0] <= '9') {
470      _debug = dlevel[0]-'0';
471    } else {
472      std::cerr << "Warning: invalid debug level" << std::endl;
473    }
474  }
475  int testlevel = 0;
476  if (tlevel) {
477    if (tlevel[0] >= '0' && tlevel[0] <= '9') {
478      testlevel = tlevel[0]-'0';
479    } else {
480      std::cerr << "Warning: invalid test level" << std::endl;
481    }
482  }
483
484  testTestFiles();
485  testKnownFiles();
486  testCorruptFiles();
487  testCompressionBackcompat();
488  testConsistencySanity();
489  if(testlevel >= 1) {
490    testCompressionVersions();
491  }
492  TESTRESULTS();
493
494  return 0;
495}
496
497}
498
499int main(int argc, char** argv) {
500  return slip::runtests(argc,argv);
501}