test/harness/gc-test.c
author ali <ali@juiblex.co.uk>
Tue Jan 24 23:54:05 2012 +0000 (2012-01-24)
changeset 0 c2f4c0285180
permissions -rw-r--r--
Initial version
ali@0
     1
#include <stdlib.h>
ali@0
     2
#include <stdio.h>
ali@0
     3
#include <string.h>
ali@0
     4
#include <gclib/gclib.h>
ali@0
     5
#include "testcase.h"
ali@0
     6
#include "testcaseio.h"
ali@0
     7
ali@0
     8
/*
ali@0
     9
 * Returns FALSE if the test should be considered to have failed.
ali@0
    10
 * (returns TRUE on pass or expected-fail).
ali@0
    11
 */
ali@0
    12
boolean run_test(const char *filename)
ali@0
    13
{
ali@0
    14
    Testcase *testcase;
ali@0
    15
    boolean retval;
ali@0
    16
    testcase=testcase_parse_file(filename);
ali@0
    17
    if (!testcase)
ali@0
    18
	return FALSE;
ali@0
    19
    retval=testcase_run(testcase);
ali@0
    20
    testcase_free(testcase);
ali@0
    21
    return retval;
ali@0
    22
}
ali@0
    23
ali@0
    24
int main(int argc,char **argv)
ali@0
    25
{
ali@0
    26
    int i;
ali@0
    27
    boolean pass=TRUE;
ali@0
    28
    for(i=1;i<argc;i++)
ali@0
    29
	pass&=run_test(argv[i]);
ali@0
    30
    return pass?0:1;
ali@0
    31
}