X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftest_matchstr.c;fp=test%2Ftest_matchstr.c;h=bdb9751223c6b9e2d258ab715a97d9a141110537;hb=3107ce3a34993d2f784387f227a50343fff83bbc;hp=0000000000000000000000000000000000000000;hpb=ed31c923f03ec124060972f5351b8b33e07a2e13;p=yaz-moved-to-github.git diff --git a/test/test_matchstr.c b/test/test_matchstr.c new file mode 100644 index 0000000..bdb9751 --- /dev/null +++ b/test/test_matchstr.c @@ -0,0 +1,43 @@ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data + * See the file LICENSE for details. + */ + +#include +#include + +#include +#include + +int main (int argc, char **argv) +{ + YAZ_CHECK_INIT(argc, argv); + + YAZ_CHECK(yaz_matchstr("x", "x") == 0); + YAZ_CHECK(yaz_matchstr("x", "X") == 0); + YAZ_CHECK(yaz_matchstr("a", "b") > 0); + YAZ_CHECK(yaz_matchstr("b", "a") > 0); + YAZ_CHECK(yaz_matchstr("aa","a") > 0); + YAZ_CHECK(yaz_matchstr("a-", "a") > 0); + YAZ_CHECK(yaz_matchstr("A-b", "ab") == 0); + YAZ_CHECK(yaz_matchstr("A--b", "ab") > 0); + YAZ_CHECK(yaz_matchstr("A--b", "a-b") > 0); + YAZ_CHECK(yaz_matchstr("A--b", "a--b") == 0); + YAZ_CHECK(yaz_matchstr("a123", "a?") == 0); + YAZ_CHECK(yaz_matchstr("a123", "a1.3") == 0); + YAZ_CHECK(yaz_matchstr("a123", "..?") == 0); + YAZ_CHECK(yaz_matchstr("a123", "a1.") > 0); + YAZ_CHECK(yaz_matchstr("a123", "a...") == 0); + + YAZ_CHECK_TERM; +} + +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +