3 This is the test harness for libarchive.
5 It compiles into a single program "libarchive_test" that is intended
6 to exercise as much of the library as possible. It is, of course,
7 very much a work in progress.
9 Each test is a function named test_foo in a file named test_foo.c.
10 Note that the file name is the same as the function name.
11 Each file must start with this line:
15 The test function must be declared with a line of this form
19 Nothing else should appear on that line.
21 When you add a test, please update the Makefile to add your
22 file to the list of tests. The Makefile and main.c use various
23 macro trickery to automatically collect a list of test functions
26 Each test function can rely on the following:
28 * The current directory will be a freshly-created empty directory
29 suitable for that test. (The top-level main() creates a
30 directory for each separate test and chdir()s to that directory
31 before running the test.)
33 * The test function should use assert(), assertA() and similar macros
34 defined in test.h. If you need to add new macros of this form, feel
35 free to do so. The current macro set includes assertEqualInt() and
36 assertEqualString() that print out additional detail about their
37 arguments if the assertion does fail. 'A' versions also accept
38 a struct archive * and display any error message from there on
41 * You are encouraged to document each assertion with a failure() call
42 just before the assert. The failure() function is a printf-like
43 function whose text is displayed only if the assertion fails. It
44 can be used to display additional information relevant to the failure:
46 failure("The data read from file %s did not match the data written to that file.", filename);
47 assert(strcmp(buff1, buff2) == 0);
49 * Tests are encouraged to be economical with their memory and disk usage,
50 though this is not essential. The test is occasionally run under
51 a memory debugger to try to locate memory leaks in the library;
52 as a result, tests should be careful to release any memory they
55 * Disable tests on specific platforms as necessary. Please don't
56 use config.h to adjust feature requirements, as I want the tests
57 to also serve as a check on the configure process. The following
60 #if !defined(__PLATFORM) && !defined(__Platform2__)