xref: /freebsd/contrib/libarchive/unzip/test/test_basic.c (revision bd66c1b43e33540205dbc1187c2f2a15c58b57ba)
1e64fe029SMartin Matuska /*
2*bd66c1b4SMartin Matuska  * SPDX-License-Identifier: BSD-2-Clause
3*bd66c1b4SMartin Matuska  *
4e64fe029SMartin Matuska  * Copyright (c) 2023 Adrian Vovk
5e64fe029SMartin Matuska  * All rights reserved.
6e64fe029SMartin Matuska  */
7e64fe029SMartin Matuska #include "test.h"
8e64fe029SMartin Matuska 
9e64fe029SMartin Matuska /* This test just does a basic zip decompression */
DEFINE_TEST(test_basic)10e64fe029SMartin Matuska DEFINE_TEST(test_basic)
11e64fe029SMartin Matuska {
12e64fe029SMartin Matuska 	const char *reffile = "test_basic.zip";
13e64fe029SMartin Matuska 	int r;
14e64fe029SMartin Matuska 
15e64fe029SMartin Matuska 	extract_reference_file(reffile);
16e64fe029SMartin Matuska 	r = systemf("%s %s >test.out 2>test.err", testprog, reffile);
17e64fe029SMartin Matuska 	assertEqualInt(0, r);
18e64fe029SMartin Matuska 	assertNonEmptyFile("test.out");
19e64fe029SMartin Matuska 	assertEmptyFile("test.err");
20e64fe029SMartin Matuska 
21e64fe029SMartin Matuska 	assertTextFileContents("contents a\n", "test_basic/a");
22e64fe029SMartin Matuska 	assertTextFileContents("contents b\n", "test_basic/b");
23e64fe029SMartin Matuska 	assertTextFileContents("contents c\n", "test_basic/c");
24e64fe029SMartin Matuska 	assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
25e64fe029SMartin Matuska }
26