1 /* $Id: test_normalize.c,v 1.1 2007-09-07 10:46:33 adam Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 #include <yaz/xmalloc.h>
30 #include "normalize7bit.h"
32 int test_normalize7bit_generic(const char *rm_chars, const char *input,
33 const char *expect_output)
36 char *tmp = xstrdup(input);
37 char *output = normalize7bit_generic(tmp, rm_chars);
38 if (!strcmp(expect_output, output))
44 int test_normalize7bit_mergekey(int skiparticle, const char *input,
45 const char *expect_output)
49 char *tmp = xstrdup(input);
50 char *output = normalize7bit_mergekey(tmp, skiparticle);
51 if (!strcmp(expect_output, output))
57 int main(int argc, char **argv)
59 YAZ_CHECK_INIT(argc, argv);
62 YAZ_CHECK(test_normalize7bit_generic("/; ", " how are you; ", "how are you"));
63 YAZ_CHECK(!test_normalize7bit_generic("/; ", " how are you; ", "how are youx"));
65 YAZ_CHECK(test_normalize7bit_generic("/; "," ", ""));
67 YAZ_CHECK(test_normalize7bit_mergekey(0, "the art of computer", "the art of computer"));
68 YAZ_CHECK(test_normalize7bit_mergekey(1, "the art of computer", "art of computer"));
70 YAZ_CHECK(test_normalize7bit_mergekey(1, "The Art Of Computer", "art of computer"));
81 * indent-tabs-mode: nil
83 * vim: shiftwidth=4 tabstop=8 expandtab