pkgsrc - initial commit
[pkgsrc.git] / archivers / libarchive / files / libarchive / test / test_read_format_iso_gz.c
1 /*-
2  * Copyright (c) 2003-2007 Tim Kientzle
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #include "test.h"
26 __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_iso_gz.c,v 1.1 2007/03/03 07:37:37 kientzle Exp $");
27
28 static unsigned char archive[] = {
29 31,139,8,8,201,'R','p','C',0,3,'t','e','s','t','-','r','e','a','d','_','f',
30 'o','r','m','a','t','.','i','s','o',0,237,219,223,'k',211,'@',28,0,240,212,
31 23,'K','}',20,169,143,135,15,162,224,218,180,']','W',186,183,173,'I',183,
32 206,254,144,'d',19,246,'$',5,';',24,'2',11,235,240,239,221,127,162,233,'f',
33 17,29,219,24,12,'\'',243,243,'!',185,187,220,']',146,';',8,9,223,131,'D',
34 17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'P',234,
35 '%','q',220,'(','E',253,211,217,'l',';','O',194,'u','z','I','6',25,']',219,
36 26,194,234,'z',241,'o',217,13,247,'-',182,229,30,149,203,'Q',229,178,170,
37 242,252,'W',243,139,'e',242,'*',170,'^',30,'U',163,242,'2','+','G',199,207,
38 158,'V','_',190,';',127,178,':',255,134,1,241,23,140,222,15,242,'I','?',15,
39 'E',26,186,27,27,'q','}',183,'8',232,15,134,'i','~',152,239,167,163,176,'}',
40 '0',24,'&','i',22,'^','/',159,159,180,'7',201,146,162,176,150,213,147,143,
41 'E','!','K',183,246,'\'','Y','x',211,'{',27,26,221,'n','+',164,181,195,201,
42 193,'x','\'',217,26,166,171,202,'N',216,171,'}','H',183,178,'|','2',174,239,
43 213,242,222,238,'`','8',28,140,'w',30,'j',186,205,'8','n','7',26,'q',167,
44 217,'j',174,183,';','q','|','~',165,'"',254,'C','t',165,'G',')','z',168,209,
45 243,'o',184,143,215,'6',220,139,239,'?',191,255,0,192,255,163,136,224,194,
46 'h',254,'5',140,231,223,'B',232,132,'f','k',179,185,190,217,238,'\\',132,
47 ':',149,147,'/',199,139,249,209,'"','4','k','q',173,21,214,230,225,'l',182,
48 '8','[',';',157,'M','?',127,':',154,159,158,'L',207,'j','E','{',152,'>',244,
49 28,0,128,187,')',']',172,177,139,255,1,0,0,224,'1',187,136,252,171,22,0,0,
50 0,0,224,'1',187,253,31,187,'[','{','X',';',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
51 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,206,
52 '~',0,137,'#',195,182,0,128,1,0};
53
54 DEFINE_TEST(test_read_format_iso_gz)
55 {
56         struct archive_entry *ae;
57         struct archive *a;
58         assert((a = archive_read_new()) != NULL);
59         assert(0 == archive_read_support_compression_all(a));
60         assert(0 == archive_read_support_format_all(a));
61         assert(0 == archive_read_open_memory(a, archive, sizeof(archive)));
62         assert(0 == archive_read_next_header(a, &ae));
63         assert(archive_compression(a) == ARCHIVE_COMPRESSION_GZIP);
64         assert(archive_format(a) == ARCHIVE_FORMAT_ISO9660);
65         assert(0 == archive_read_close(a));
66 #if ARCHIVE_API_VERSION > 1
67         assert(0 == archive_read_finish(a));
68 #else
69         archive_read_finish(a);
70 #endif
71 }
72
73