2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: test.c,v 1.2 2006-01-27 19:01:56 adam Exp $
16 static FILE *test_fout = 0; /* can't init this to stderr on some systems */
17 static int test_number = 0;
18 static int test_verbose = 0;
20 void yaz_check_init1(int *argc_p, char ***argv_p)
24 char **argv = *argv_p;
26 for (i = 1; i<argc; i++)
28 if (strlen(argv[i]) >= 7 && !memcmp(argv[i], "--test-", 7))
30 const char *suf = argv[i]+7;
31 if (i < argc-1 && !strcmp(suf, "file"))
36 test_fout = fopen(argv[i], "w");
39 else if (i < argc-1 && !strcmp(suf, "verbose"))
42 test_verbose = atoi(argv[i]);
45 else if (!strcmp(suf, "help"))
49 "--test-verbose level verbose; 0=quiet; 1=normal; 2=more\n"
50 "--test-file fname output to fname\n");
55 fprintf(stderr, "Unrecognized option for YAZ test: %s\n",
57 fprintf(stderr, "Use --test-help for more info\n");
64 /* remove --test- options from argc, argv so that they disappear */
65 (*argv_p)[i-1] = **argv_p; /* program name */
70 test_fout = stdout; /* by default, set output to this */
73 void yaz_check_print1(int type, const char *file, int line, const char *expr)
75 const char *msg = "unknown";
80 case YAZ_TEST_TYPE_FAIL:
85 case YAZ_TEST_TYPE_OK:
91 fprintf(test_fout, "%s:%d %s: %s\n", file, line, msg, expr);
98 * indent-tabs-mode: nil
100 * vim: shiftwidth=4 tabstop=8 expandtab