X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Ftest.c;h=c00c0bf2c560131a9445699a8ced037bbeb976b4;hp=7803177c84995f657fd7fed485375b111d675d4b;hb=fcea26f3542a6097ad258cdbb6e57565366d5f35;hpb=5ed3b6561d90d13f64be7f9ae8beaf4a0b3f8e32 diff --git a/src/test.c b/src/test.c index 7803177..c00c0bf 100644 --- a/src/test.c +++ b/src/test.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. - * - * $Id: test.c,v 1.10 2006-07-07 13:39:04 heikki Exp $ */ /** \file test.c @@ -29,9 +27,9 @@ static int test_failed = 0; static int test_todo = 0; static int test_verbose = 1; static const char *test_prog = 0; -static int log_tests = 0; +static int log_tests = 0; -static FILE *get_file() +static FILE *get_file(void) { if (test_fout) return test_fout; @@ -78,7 +76,7 @@ void yaz_check_init1(int *argc_p, char ***argv_p) } else if (!strcmp(suf, "help")) { - fprintf(stderr, + fprintf(stderr, "--test-help help\n" "--test-file fname output to fname\n" "--test-verbose level verbose level\n" @@ -97,7 +95,7 @@ void yaz_check_init1(int *argc_p, char ***argv_p) fprintf(stderr, "Use --test-help for more info\n"); exit(1); } - + } break; } @@ -112,7 +110,7 @@ void yaz_check_init1(int *argc_p, char ***argv_p) void yaz_check_init_log(const char *argv0) { char logfilename[2048]; - log_tests = 1; + log_tests = 1; sprintf(logfilename,"%s.log", progname(argv0) ); yaz_log_init_file(logfilename); yaz_log_trunc(); @@ -162,15 +160,15 @@ void yaz_check_eq1(int type, const char *file, int line, const char *left, const char *right, int lval, int rval) { char formstr[2048]; - - if (type == YAZ_TEST_TYPE_OK) + + if (type == YAZ_TEST_TYPE_OK) sprintf(formstr, "%.500s == %.500s ", left, right); else sprintf(formstr, "%.500s != %.500s\n %d != %d", left, right, lval,rval); yaz_check_print1(type, file, line, formstr); } -void yaz_check_print1(int type, const char *file, int line, +void yaz_check_print1(int type, const char *file, int line, const char *expr) { const char *msg = "unknown"; @@ -193,7 +191,7 @@ void yaz_check_print1(int type, const char *file, int line, } if (printit) { - fprintf(get_file(), "%s:%d %s: ", file, line, msg); + fprintf(get_file(), "%s:%d: %s: ", file, line, msg); fprintf(get_file(), "%s\n", expr); } if (log_tests) @@ -212,6 +210,7 @@ int yaz_test_get_verbosity() /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab