1 /* This file is part of Pazpar2.
2 Copyright (C) 2006-2009 Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <yaz/xmalloc.h>
28 #include "normalize7bit.h"
30 int test_normalize7bit_generic(const char *rm_chars, const char *input,
31 const char *expect_output)
34 char *tmp = xstrdup(input);
35 char *output = normalize7bit_generic(tmp, rm_chars);
36 if (!strcmp(expect_output, output))
42 int test_normalize7bit_mergekey(int skiparticle, const char *input,
43 const char *expect_output)
47 char *tmp = xstrdup(input);
48 char *output = normalize7bit_mergekey(tmp, skiparticle);
49 if (!strcmp(expect_output, output))
55 int main(int argc, char **argv)
57 YAZ_CHECK_INIT(argc, argv);
60 YAZ_CHECK(test_normalize7bit_generic("/; ", " how are you; ", "how are you"));
61 YAZ_CHECK(!test_normalize7bit_generic("/; ", " how are you; ", "how are youx"));
63 YAZ_CHECK(test_normalize7bit_generic("/; "," ", ""));
65 YAZ_CHECK(test_normalize7bit_mergekey(0, "the art of computer", "the art of computer"));
66 YAZ_CHECK(test_normalize7bit_mergekey(1, "the art of computer", "art of computer"));
68 YAZ_CHECK(test_normalize7bit_mergekey(1, "The Art Of Computer", "art of computer"));
79 * c-file-style: "Stroustrup"
80 * indent-tabs-mode: nil
82 * vim: shiftwidth=4 tabstop=8 expandtab