X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftstquery.cpp;h=28acf6ab407ad476d723f5e8413707b19e651d7f;hb=811aa170af425409aef732209f3052807e8af94d;hp=16cfe0a21196365fb61071ac77cc84d854bd570d;hpb=0cc824e02bc2c69986bec8c9dd9ff53f07a0cd3d;p=yazpp-moved-to-github.git diff --git a/src/tstquery.cpp b/src/tstquery.cpp index 16cfe0a..28acf6a 100644 --- a/src/tstquery.cpp +++ b/src/tstquery.cpp @@ -1,16 +1,19 @@ -/* - * Copyright (c) 1998-2005, Index Data. +/* This file is part of the yazpp toolkit. + * Copyright (C) 1998-2013 Index Data and Mike Taylor * See the file LICENSE for details. - * - * $Id: tstquery.cpp,v 1.2 2006-03-29 13:14:15 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include +#include +#include using namespace yazpp_1; -void tst1(const char *query_str_in, const char *query_expected) +int tst1(const char *query_str_in, const char *query_expected) { Yaz_Z_Query q; @@ -25,23 +28,28 @@ void tst1(const char *query_str_in, const char *query_expected) if (strcmp(query_str_out, query_expected)) { - fprintf(stderr, "tstquery: query mismatch out=%s expected=%s\n", + yaz_log(YLOG_LOG, "query mismatch out=%s expected=%s", query_str_out, query_expected); - exit(1); + return 0; } + return 1; } int main(int argc, char **argv) { - tst1("", ""); - tst1("x", "RPN: @attrset Bib-1 x"); - tst1("@and a b", "RPN: @attrset Bib-1 @and a b"); + YAZ_CHECK_INIT(argc, argv); + YAZ_CHECK(tst1("", "")); + YAZ_CHECK(tst1("x", "RPN @attrset Bib-1 x")); + YAZ_CHECK(tst1("@and a b", "RPN @attrset Bib-1 @and a b")); + YAZ_CHECK_TERM; } /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +