iPXE
zlib_test.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Michael Brown <mbrown@fensystems.co.uk>.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
22 */
23
24FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25
26/** @file
27 *
28 * zlib image tests
29 *
30 */
31
32/* Forcibly enable assertions */
33#undef NDEBUG
34
35#include <ipxe/zlib.h>
36#include <ipxe/test.h>
37#include "archive_test.h"
38
39/** "Hello world" */
40ARCHIVE_TEST ( hello_world, &zlib_image_type, "hello.z", NULL, "hello",
41 BINFILE ( 0x78, 0x9c, 0xf3, 0x48, 0xcd, 0xc9, 0xc9, 0x57, 0x28, 0xcf,
42 0x2f, 0xca, 0x49, 0x01, 0x00, 0x18, 0xab, 0x04, 0x3d ),
43 TEXTFILE ( "Hello world" ) );
44
45/**
46 * Perform zlib self-test
47 *
48 */
49static void zlib_test_exec ( void ) {
50
51 archive_ok ( &hello_world );
52}
53
54/** zlib self-test */
55struct self_test zlib_test __self_test = {
56 .name = "zlib",
57 .exec = zlib_test_exec,
58};
#define NULL
NULL pointer (VOID *).
Definition Base.h:321
#define archive_ok(test)
Report an archive extraction test result.
#define ARCHIVE_TEST(name, TYPE, ARCHIVE_NAME, EXTRACT_NAME, EXPECTED_NAME, ARCHIVE, EXPECTED)
Define an archive extraction test.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
A self-test set.
Definition test.h:15
Self-test infrastructure.
#define __self_test
Declare a self-test.
Definition test.h:32
#define BINFILE(...)
Define inline binary file content.
Definition test.h:50
#define TEXTFILE(text)
Define inline text file content.
Definition test.h:53
zlib compressed images
static void zlib_test_exec(void)
Perform zlib self-test.
Definition zlib_test.c:49