ali@0: #include ali@0: #include ali@0: #include ali@6: #include ali@5: #include ali@0: #include "testcase.h" ali@0: #include "testcaseio.h" ali@0: ali@96: static gboolean show_output; ali@96: ali@96: static GOptionEntry options[]={ ali@96: { "show-output", 'o', 0, G_OPTION_ARG_NONE, &show_output, ali@96: "Show bookloupe output", NULL }, ali@96: { NULL } ali@96: }; ali@96: ali@0: /* ali@0: * Returns FALSE if the test should be considered to have failed. ali@0: * (returns TRUE on pass or expected-fail). ali@0: */ ali@6: gboolean run_test(const char *filename) ali@0: { ali@0: Testcase *testcase; ali@6: gboolean retval; ali@0: testcase=testcase_parse_file(filename); ali@0: if (!testcase) ali@0: return FALSE; ali@96: if (show_output) ali@96: retval=testcase_show_output(testcase); ali@96: else ali@96: retval=testcase_run(testcase); ali@0: testcase_free(testcase); ali@0: return retval; ali@0: } ali@0: ali@0: int main(int argc,char **argv) ali@0: { ali@0: int i; ali@6: gboolean pass=TRUE; ali@96: GError *err=NULL; ali@96: GOptionContext *context; ali@96: context=g_option_context_new("file - run a bookloupe testcase"); ali@96: g_option_context_add_main_entries(context,options,NULL); ali@96: if (!g_option_context_parse(context,&argc,&argv,&err)) ali@96: { ali@96: g_printerr("loupe-test: %s\n",err->message); ali@96: g_printerr("Use \"%s --help\" for help\n",argv[0]); ali@96: exit(1); ali@96: } ali@11: bl_set_print_handlers(); ali@0: for(i=1;i