test/harness/loupe-test.c
author ali <ali@juiblex.co.uk>
Fri Jan 27 21:40:35 2012 +0000 (2012-01-27)
changeset 7 721e468c10f3
parent 5 f600b0d1fc5d
child 11 4a80c6053a66
permissions -rw-r--r--
Add support for non-ASCII testcases
ali@0
     1
#include <stdlib.h>
ali@0
     2
#include <stdio.h>
ali@0
     3
#include <string.h>
ali@6
     4
#include <glib.h>
ali@5
     5
#include <bl/bl.h>
ali@0
     6
#include "testcase.h"
ali@0
     7
#include "testcaseio.h"
ali@0
     8
ali@0
     9
/*
ali@0
    10
 * Returns FALSE if the test should be considered to have failed.
ali@0
    11
 * (returns TRUE on pass or expected-fail).
ali@0
    12
 */
ali@6
    13
gboolean run_test(const char *filename)
ali@0
    14
{
ali@0
    15
    Testcase *testcase;
ali@6
    16
    gboolean retval;
ali@0
    17
    testcase=testcase_parse_file(filename);
ali@0
    18
    if (!testcase)
ali@0
    19
	return FALSE;
ali@0
    20
    retval=testcase_run(testcase);
ali@0
    21
    testcase_free(testcase);
ali@0
    22
    return retval;
ali@0
    23
}
ali@0
    24
ali@0
    25
int main(int argc,char **argv)
ali@0
    26
{
ali@0
    27
    int i;
ali@6
    28
    gboolean pass=TRUE;
ali@0
    29
    for(i=1;i<argc;i++)
ali@0
    30
	pass&=run_test(argv[i]);
ali@0
    31
    return pass?0:1;
ali@0
    32
}