test/harness/loupe-test.c
author ali <ali@juiblex.co.uk>
Sun Feb 19 21:08:53 2012 +0000 (2012-02-19)
changeset 31 20c603ca5649
parent 6 faab25d520dd
child 96 8c2d6a0cf717
permissions -rw-r--r--
Add testcase for words that shouldn't immediately preceed periods
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@0
    30
    for(i=1;i<argc;i++)
ali@0
    31
	pass&=run_test(argv[i]);
ali@0
    32
    return pass?0:1;
ali@0
    33
}