test_write_format_zip_empty.c (302408) | test_write_format_zip_empty.c (311041) |
---|---|
1/*- 2 * Copyright (c) 2008 Anselm Strauss 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 --- 14 unchanged lines hidden (view full) --- 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26/* 27 * Development supported by Google Summer of Code 2008. 28 */ 29 30#include "test.h" | 1/*- 2 * Copyright (c) 2008 Anselm Strauss 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 --- 14 unchanged lines hidden (view full) --- 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26/* 27 * Development supported by Google Summer of Code 2008. 28 */ 29 30#include "test.h" |
31__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c 248616 2013-03-22 13:36:03Z mm $"); | 31__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c 311041 2017-01-02 01:41:31Z mm $"); |
32 33DEFINE_TEST(test_write_format_zip_empty) 34{ 35 struct archive *a; 36 struct archive_entry *ae; 37 char buff[256]; 38 size_t used; 39 --- 4 unchanged lines hidden (view full) --- 44 assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); 45 assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); 46 assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); 47 48 /* Close out the archive without writing anything. */ 49 assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); 50 assertEqualInt(ARCHIVE_OK, archive_write_free(a)); 51 | 32 33DEFINE_TEST(test_write_format_zip_empty) 34{ 35 struct archive *a; 36 struct archive_entry *ae; 37 char buff[256]; 38 size_t used; 39 --- 4 unchanged lines hidden (view full) --- 44 assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); 45 assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); 46 assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); 47 48 /* Close out the archive without writing anything. */ 49 assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); 50 assertEqualInt(ARCHIVE_OK, archive_write_free(a)); 51 |
52 /* Verify the correct format for an empy Zip archive. */ | 52 /* Verify the correct format for an empty Zip archive. */ |
53 assertEqualInt(used, 22); 54 assertEqualMem(buff, 55 "PK\005\006\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 56 22); 57 58 /* Verify that we read this kind of empty archive correctly. */ 59 /* Try with the standard memory reader, and with the test 60 memory reader with and without seek support. */ --- 18 unchanged lines hidden --- | 53 assertEqualInt(used, 22); 54 assertEqualMem(buff, 55 "PK\005\006\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 56 22); 57 58 /* Verify that we read this kind of empty archive correctly. */ 59 /* Try with the standard memory reader, and with the test 60 memory reader with and without seek support. */ --- 18 unchanged lines hidden --- |