GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> ZFS / V0-0-2 > zlib_unit_test / sun-gcc
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ZLIB/zlib.h>
#include <ZFS/ZLIB_msg.h>
#include <ZFS/ZLIB_file_inflate.h>
#include <ZFS/ZLIB_file_compress.h>
#include <ZFS/zlib_unit_test.h>
#include <PBI/PTR.h>
#include <PBS/PBS.h>
#include <PBS/BSWP.h>
#include <PBS/MBA.h>
#include <PBS/TASK.h>
#include <MSG/MSG_pubdefs.h>
#include <MSG/MSG_printProc.h>
Defines | |
#define | ZLIB_ARG_VALUE 0x12345678 |
#define | POINTER_FORMAT "0x%08x" |
Functions | |
int | PBS_shutdown (void) |
static int | zlib_inflate_test_param (void) |
static int | zlib_inflate_test_func (void) |
static int | zlib_inflate_test_data_err (void) |
static int | zlib_compress_test_param (void) |
static int | zlib_compress_test_func (void) |
static int | zlib_file_inflate_test_param (void) |
static int | zlib_file_compress_test_param (void) |
static void * | zlib_alloc (void *arg, unsigned int items, unsigned int size) |
static void | zlib_free (void *arg, void *address) |
static void | zlib_print (z_streamp s, const char *msg) |
int | zlib_unit_test (void) |
int | main (int argc, char **argv) |
Variables | |
unsigned char | zlib_orig_buf_0 [] |
unsigned char | zlib_comp_buf_0 [] |
unsigned char | zlib_err_buf_0 [] |
unsigned int | zlib_orig_buf_0_size |
unsigned int | zlib_comp_buf_0_size |
unsigned int | zlib_err_buf_0_size |
unsigned char | zlib_orig_buf_1 [] |
unsigned char | zlib_comp_buf_1 [] |
unsigned char | zlib_err_buf_1 [] |
unsigned int | zlib_orig_buf_1_size |
unsigned int | zlib_comp_buf_1_size |
unsigned int | zlib_err_buf_1_size |
static const char * | sepStr = "-----------------------------------------------------------\n" |
Tests the following constituents:
#define ZLIB_ARG_VALUE 0x12345678 |
A dummy value passed to the memory allocation callbacks. Used to check that callback arg passing is working correctly.
Referenced by zlib_alloc(), zlib_compress_test_func(), zlib_compress_test_param(), zlib_free(), zlib_inflate_test_data_err(), zlib_inflate_test_func(), and zlib_inflate_test_param().
int main | ( | int | argc, | |
char ** | argv | |||
) |
The UNIX application entry point.
argc | The number of command line args. | |
argv | The list of command line args. |
0 | Success. | |
-1 | Failure. |
References zlib_unit_test().
int PBS_shutdown | ( | void | ) |
PBS global shutdown function.
Referenced by zlib_unit_test().
static void * zlib_alloc | ( | void * | arg, | |
unsigned int | items, | |||
unsigned int | size | |||
) | [static] |
ZLIB memory allocation function used for the unit tests.
arg | A user defined argument. | |
items | The number of items to allocate. | |
size | The size of each item to allocate. |
References ZLIB_ARG_VALUE.
Referenced by zlib_compress_test_func(), zlib_compress_test_param(), zlib_inflate_test_data_err(), zlib_inflate_test_func(), and zlib_inflate_test_param().
static int zlib_compress_test_func | ( | void | ) | [static] |
Tests the basic functionality of the deflate() interface by compressing some sample data sets.
0 | Success. | |
-1 | Failure. |
References zlib_alloc(), ZLIB_ARG_VALUE, zlib_comp_buf_0, zlib_comp_buf_0_size, zlib_comp_buf_1, zlib_comp_buf_1_size, zlib_free(), zlib_orig_buf_0, zlib_orig_buf_0_size, zlib_orig_buf_1, zlib_orig_buf_1_size, and zlib_print().
Referenced by zlib_unit_test().
static int zlib_compress_test_param | ( | void | ) | [static] |
Performs invalid and out of range tests on parameters for zlib_compress library functions.
0 | Success. | |
-1 | Failure |
References zlib_alloc(), ZLIB_ARG_VALUE, zlib_comp_buf_0_size, zlib_free(), zlib_orig_buf_0, and zlib_orig_buf_0_size.
Referenced by zlib_unit_test().
static int zlib_file_compress_test_param | ( | void | ) | [static] |
Performs invalid and out of range tests on parameters for zlib_file_compress library functions.
0 | Success. | |
-1 | Failure |
References sepStr, and ZLIB_fileCompressFromFile().
Referenced by zlib_unit_test().
static int zlib_file_inflate_test_param | ( | void | ) | [static] |
Performs invalid and out of range tests on parameters for zlib_file_inflate library functions.
0 | Success. | |
-1 | Failure |
References sepStr, ZLIB_fileInflateSizeof(), ZLIB_fileInflateToFile(), and ZLIB_fileInflateToMem().
Referenced by zlib_unit_test().
static void zlib_free | ( | void * | arg, | |
void * | address | |||
) | [static] |
ZLIB memory release function used for the unit tests.
arg | A user defined argument. | |
address | The address of the memory to free. |
References ZLIB_ARG_VALUE.
Referenced by zlib_compress_test_func(), zlib_compress_test_param(), zlib_inflate_test_data_err(), zlib_inflate_test_func(), and zlib_inflate_test_param().
static int zlib_inflate_test_data_err | ( | void | ) | [static] |
Tests the inflate() to make sure it signals an error on a corrupted compressed data set.
0 | Success. | |
-1 | Failure. |
References zlib_alloc(), ZLIB_ARG_VALUE, zlib_err_buf_0, zlib_err_buf_0_size, zlib_err_buf_1, zlib_err_buf_1_size, zlib_free(), zlib_orig_buf_0_size, zlib_orig_buf_1_size, and zlib_print().
Referenced by zlib_unit_test().
static int zlib_inflate_test_func | ( | void | ) | [static] |
Tests the basic functionality of the inflate() interface by inflating some sample data sets.
0 | Success. | |
-1 | Failure. |
References zlib_alloc(), ZLIB_ARG_VALUE, zlib_comp_buf_0, zlib_comp_buf_0_size, zlib_comp_buf_1, zlib_comp_buf_1_size, zlib_free(), zlib_orig_buf_0, zlib_orig_buf_0_size, zlib_orig_buf_1, zlib_orig_buf_1_size, and zlib_print().
Referenced by zlib_unit_test().
static int zlib_inflate_test_param | ( | void | ) | [static] |
Performs invalid and out of range tests on parameters for zlib_inflate library functions.
0 | Success. | |
-1 | Failure |
References zlib_alloc(), ZLIB_ARG_VALUE, zlib_comp_buf_0, zlib_comp_buf_0_size, zlib_free(), and zlib_orig_buf_0_size.
Referenced by zlib_unit_test().
static void zlib_print | ( | z_streamp | s, | |
const char * | msg | |||
) | [static] |
Displays the state of the ZLIB stream.
s | A pointer to the ZLIB stream descriptor. | |
msg | A message to display at top of printout. |
References sepStr.
Referenced by zlib_compress_test_func(), zlib_inflate_test_data_err(), and zlib_inflate_test_func().
iint zlib_unit_test | ( | void | ) |
Performs all of the unit tests associated with the ZLIB package. Tests the following constituents:
0 | Success. | |
-1 | Failure |
References PBS_shutdown(), sepStr, zlib_compress_test_func(), zlib_compress_test_param(), zlib_file_compress_test_param(), zlib_file_inflate_test_param(), zlib_inflate_test_data_err(), zlib_inflate_test_func(), and zlib_inflate_test_param().
Referenced by main().
sepStr = "-----------------------------------------------------------\n" [static] |
A line separator string.
Referenced by zlib_file_compress_test_param(), zlib_file_inflate_test_param(), zlib_print(), and zlib_unit_test().
The correct compressed format of zlib_orig_buf_0.
The correct compressed format of zlib_orig_buf_0.
Referenced by zlib_compress_test_func(), zlib_inflate_test_func(), and zlib_inflate_test_param().
The size in bytes of zlib_comp_buf_0.
The size in bytes of zlib_comp_buf_0.
Referenced by zlib_compress_test_func(), zlib_compress_test_param(), zlib_inflate_test_func(), and zlib_inflate_test_param().
The correct compressed format of zlib_orig_buf_1.
The correct compressed format of zlib_orig_buf_1.
Referenced by zlib_compress_test_func(), and zlib_inflate_test_func().
The size in bytes of zlib_comp_buf_1.
The size in bytes of zlib_comp_buf_1.
Referenced by zlib_compress_test_func(), and zlib_inflate_test_func().
The compressed format of zlib_orig_buf_0 with a single bit error.
The compressed format of zlib_orig_buf_0 with a single bit error.
Referenced by zlib_inflate_test_data_err().
The size in bytes of zlib_err_buf_0.
The size in bytes of zlib_err_buf_0.
Referenced by zlib_inflate_test_data_err().
The compressed format of zlib_orig_buf_1 with a single bit error.
The compressed format of zlib_orig_buf_1 with a single bit error.
Referenced by zlib_inflate_test_data_err().
The size in bytes of zlib_err_buf_1.
The size in bytes of zlib_err_buf_1.
Referenced by zlib_inflate_test_data_err().
A sample of an original data file to be compressed.
A sample of an original data file to be compressed.
Referenced by zlib_compress_test_func(), zlib_compress_test_param(), and zlib_inflate_test_func().
The size in bytes of zlib_orig_buf_0.
The size in bytes of zlib_orig_buf_0.
Referenced by zlib_compress_test_func(), zlib_compress_test_param(), zlib_inflate_test_data_err(), zlib_inflate_test_func(), and zlib_inflate_test_param().
A sample of an original data file to be compressed.
A sample of an original data file to be compressed.
Referenced by zlib_compress_test_func(), and zlib_inflate_test_func().
The size in bytes of zlib_orig_buf_1.
The size in bytes of zlib_orig_buf_1.
Referenced by zlib_compress_test_func(), zlib_inflate_test_data_err(), and zlib_inflate_test_func().