11471SN/A/*-
22527SN/A * Copyright (c) 2003-2007 Tim Kientzle
31471SN/A * All rights reserved.
41471SN/A *
51471SN/A * Redistribution and use in source and binary forms, with or without
61471SN/A * modification, are permitted provided that the following conditions
71471SN/A * are met:
81471SN/A * 1. Redistributions of source code must retain the above copyright
91471SN/A *    notice, this list of conditions and the following disclaimer.
101471SN/A * 2. Redistributions in binary form must reproduce the above copyright
111471SN/A *    notice, this list of conditions and the following disclaimer in the
121471SN/A *    documentation and/or other materials provided with the distribution.
131471SN/A *
141471SN/A * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
151471SN/A * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
161471SN/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
171471SN/A * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
181471SN/A * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191471SN/A * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
201471SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
211471SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
221471SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
231471SN/A * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241471SN/A */
253170Svasya#include "test.h"
261471SN/A__FBSDID("$FreeBSD$");
271471SN/A
283792Salanbstatic unsigned char archive[] = {
291471SN/A31,157,144,'.',0,8,28,'H',176,160,193,131,8,19,'*','\\',200,176,'!','B',24,
301471SN/A16,'o',212,168,1,2,0,196,24,18,'a','T',188,152,'q','#',196,143,' ','5',198,
311471SN/A128,'1','c',6,13,24,'4','0',206,176,1,2,198,200,26,'6','b',0,0,'Q',195,161,
323294Salanb205,155,'8','s',234,4,'P','g',14,157,'0','r',',',194,160,147,166,205,206,
333665Ssdrach132,'D',141,30,'=',24,'R',163,'P',144,21,151,'J',157,'J',181,170,213,171,
343665Ssdrach'X',179,'j',221,202,181,171,215,175,'`',195,138,29,'K',182,172,217,179,'h',
353419Smchung211,170,']',203,182,173,219,183,'g',1};
362721SN/A
372721SN/ADEFINE_TEST(test_read_format_tz)
382721SN/A{
392721SN/A	struct archive_entry *ae;
403294Salanb	struct archive *a;
412721SN/A	assert((a = archive_read_new()) != NULL);
422721SN/A	assertEqualIntA(a, ARCHIVE_OK,
431471SN/A	    archive_read_support_compression_all(a));
441471SN/A	assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
453294Salanb	assertEqualIntA(a, ARCHIVE_OK,
463294Salanb	    archive_read_open_memory(a, archive, sizeof(archive)));
473294Salanb	assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
483294Salanb	failure("archive_compression_name(a)=\"%s\"",
493294Salanb	    archive_compression_name(a));
503294Salanb	assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
513294Salanb	failure("archive_format_name(a)=\"%s\"", archive_format_name(a));
521471SN/A	assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
531471SN/A	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
542721SN/A#if ARCHIVE_VERSION_NUMBER < 2000000
553418Smchung	archive_read_finish(a);
563665Ssdrach#else
571471SN/A	assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
581471SN/A#endif
591471SN/A}
601471SN/A
611471SN/A
623419Smchung