nkeynes@185: /* nkeynes@263: * $Id: testdata.h,v 1.3 2007-01-03 09:05:13 nkeynes Exp $ nkeynes@185: * nkeynes@185: * Test data loader nkeynes@185: * nkeynes@185: * Copyright (c) 2006 Nathan Keynes. nkeynes@185: * nkeynes@185: * This program is free software; you can redistribute it and/or modify nkeynes@185: * it under the terms of the GNU General Public License as published by nkeynes@185: * the Free Software Foundation; either version 2 of the License, or nkeynes@185: * (at your option) any later version. nkeynes@185: * nkeynes@185: * This program is distributed in the hope that it will be useful, nkeynes@185: * but WITHOUT ANY WARRANTY; without even the implied warranty of nkeynes@185: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nkeynes@185: * GNU General Public License for more details. nkeynes@185: */ nkeynes@185: nkeynes@185: #include nkeynes@185: nkeynes@190: #define MAX_DATA_BLOCKS 16 nkeynes@185: nkeynes@185: typedef struct test_data_block { nkeynes@185: const char *name; nkeynes@185: unsigned int length; nkeynes@185: char *data; nkeynes@185: } *test_data_block_t; nkeynes@185: nkeynes@185: typedef struct test_data { nkeynes@185: const char *test_name; nkeynes@185: struct test_data *next; nkeynes@185: struct test_data_block item[MAX_DATA_BLOCKS]; nkeynes@185: } *test_data_t; nkeynes@185: nkeynes@263: typedef int (*test_func_t)(); nkeynes@263: int run_tests( test_func_t *tests ); nkeynes@263: nkeynes@185: test_data_t load_test_dataset( FILE *f ); nkeynes@185: void free_test_dataset( test_data_t dataset ); nkeynes@185: void dump_test_dataset( FILE *f, test_data_t dataset ); nkeynes@185: int test_block_compare( test_data_block_t expect, char *actual, int actual_length ); nkeynes@185: test_data_block_t get_test_data( test_data_t dataset, char *item_name ); nkeynes@185: