filename | test/testdata.h |
changeset | 263:6f641270b2aa |
prev | 190:f7653df5e832 |
next | 561:533f6b478071 |
author | nkeynes |
date | Sat Nov 17 01:13:41 2007 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Detect presence of SH4 + ARM cross-compilers, and disable the system tests if we don't find the sh-elf environment. Detect build host to see if we can make a working translator |
file | annotate | diff | log | raw |
nkeynes@185 | 1 | /* |
nkeynes@263 | 2 | * $Id: testdata.h,v 1.3 2007-01-03 09:05:13 nkeynes Exp $ |
nkeynes@185 | 3 | * |
nkeynes@185 | 4 | * Test data loader |
nkeynes@185 | 5 | * |
nkeynes@185 | 6 | * Copyright (c) 2006 Nathan Keynes. |
nkeynes@185 | 7 | * |
nkeynes@185 | 8 | * This program is free software; you can redistribute it and/or modify |
nkeynes@185 | 9 | * it under the terms of the GNU General Public License as published by |
nkeynes@185 | 10 | * the Free Software Foundation; either version 2 of the License, or |
nkeynes@185 | 11 | * (at your option) any later version. |
nkeynes@185 | 12 | * |
nkeynes@185 | 13 | * This program is distributed in the hope that it will be useful, |
nkeynes@185 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
nkeynes@185 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
nkeynes@185 | 16 | * GNU General Public License for more details. |
nkeynes@185 | 17 | */ |
nkeynes@185 | 18 | |
nkeynes@185 | 19 | #include <stdio.h> |
nkeynes@185 | 20 | |
nkeynes@190 | 21 | #define MAX_DATA_BLOCKS 16 |
nkeynes@185 | 22 | |
nkeynes@185 | 23 | typedef struct test_data_block { |
nkeynes@185 | 24 | const char *name; |
nkeynes@185 | 25 | unsigned int length; |
nkeynes@185 | 26 | char *data; |
nkeynes@185 | 27 | } *test_data_block_t; |
nkeynes@185 | 28 | |
nkeynes@185 | 29 | typedef struct test_data { |
nkeynes@185 | 30 | const char *test_name; |
nkeynes@185 | 31 | struct test_data *next; |
nkeynes@185 | 32 | struct test_data_block item[MAX_DATA_BLOCKS]; |
nkeynes@185 | 33 | } *test_data_t; |
nkeynes@185 | 34 | |
nkeynes@263 | 35 | typedef int (*test_func_t)(); |
nkeynes@263 | 36 | int run_tests( test_func_t *tests ); |
nkeynes@263 | 37 | |
nkeynes@185 | 38 | test_data_t load_test_dataset( FILE *f ); |
nkeynes@185 | 39 | void free_test_dataset( test_data_t dataset ); |
nkeynes@185 | 40 | void dump_test_dataset( FILE *f, test_data_t dataset ); |
nkeynes@185 | 41 | int test_block_compare( test_data_block_t expect, char *actual, int actual_length ); |
nkeynes@185 | 42 | test_data_block_t get_test_data( test_data_t dataset, char *item_name ); |
nkeynes@185 | 43 |
.