test/harness/loupe-test.c
author ali <ali@juiblex.co.uk>
Sun Sep 29 22:51:27 2013 +0100 (2013-09-29)
changeset 136 2f3762ff90d8
parent 11 4a80c6053a66
child 139 c130152c4a57
permissions -rw-r--r--
Fix bug #14: Add a configuration file
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@11
    29
    bl_set_print_handlers();
ali@136
    30
    g_setenv("BOOKLOUPE_CONFIG_PATH",".",TRUE);
ali@0
    31
    for(i=1;i<argc;i++)
ali@0
    32
	pass&=run_test(argv[i]);
ali@0
    33
    return pass?0:1;
ali@0
    34
}