X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftest.c;h=f6dd704d311e8c76e89e8e54f370afc2eaf011f2;hb=6fda497bc3df847077e0d72f487c2251df522715;hp=967b53b2a28cb99305375291f3cc5a13f40c7fe3;hpb=06ae818deffa84ec4bc1308051ef411845dd4ce5;p=yaz-moved-to-github.git diff --git a/src/test.c b/src/test.c index 967b53b..f6dd704 100644 --- a/src/test.c +++ b/src/test.c @@ -2,8 +2,13 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: test.c,v 1.3 2006-01-29 21:59:13 adam Exp $ + * $Id: test.c,v 1.6 2006-04-26 16:58:27 heikki Exp $ */ + +/** \file test.c + \brief Unit Test for YAZ +*/ + #if HAVE_CONFIG_H #include #endif @@ -118,7 +123,20 @@ void yaz_check_term1(void) exit(0); } -void yaz_check_print1(int type, const char *file, int line, const char *expr) +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) + 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, + const char *expr) { const char *msg = "unknown"; @@ -127,17 +145,18 @@ void yaz_check_print1(int type, const char *file, int line, const char *expr) { case YAZ_TEST_TYPE_FAIL: test_failed++; - msg = "failed"; + msg = "FAILED"; if (test_verbose < 1) return; break; case YAZ_TEST_TYPE_OK: - msg = "OK"; + msg = "ok"; if (test_verbose < 3) return; break; } - fprintf(get_file(), "%s:%d %s: %s\n", file, line, msg, expr); + fprintf(get_file(), "%s:%d %s: ", file, line, msg); + fprintf(get_file(), "%s\n", expr); }