Search
lxdream.org :: lxdream/test/testdata.h
lxdream 0.9.1
released Jun 29
Download Now
filename test/testdata.h
changeset 561:533f6b478071
prev263:6f641270b2aa
author nkeynes
date Tue Jan 01 05:08:38 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Enable Id keyword on all source files
file annotate diff log raw
nkeynes@185
     1
/*
nkeynes@561
     2
 * $Id$
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
.