2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: test.c,v 1.1 2006-01-27 18:58:58 adam Exp $
16 static FILE *test_fout;
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;
27 for (i = 1; i<argc; i++)
29 if (strlen(argv[i]) >= 7 && !memcmp(argv[i], "--test-", 7))
31 const char *suf = argv[i]+7;
32 if (i < argc-1 && !strcmp(suf, "file"))
37 test_fout = fopen(argv[i], "w");
40 else if (i < argc-1 && !strcmp(suf, "verbose"))
43 test_verbose = atoi(argv[i]);
46 else if (!strcmp(suf, "help"))
50 "--test-verbose level verbose; 0=quiet; 1=normal; 2=more\n"
51 "--test-file fname output to fname\n");
56 fprintf(stderr, "Unrecognized option for YAZ test: %s\n",
58 fprintf(stderr, "Use --test-help for more info\n");
65 /* remove --test- options from argc, argv so that they disappear */
66 (*argv_p)[i-1] = **argv_p; /* program name */
74 void yaz_check_print1(int type, const char *file, int line, const char *expr)
76 const char *msg = "unknown";
81 case YAZ_TEST_TYPE_FAIL:
86 case YAZ_TEST_TYPE_OK:
92 fprintf(test_fout, "%s:%d %s: %s\n", file, line, msg, expr);
99 * indent-tabs-mode: nil
101 * vim: shiftwidth=4 tabstop=8 expandtab