Debian Codegraph @

tests/findTable.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Copyright (C) 2015 Bert Frees <[email protected]>
4
5 Copying and distribution of this file, with or without modification,
6 are permitted in any medium without royalty provided the copyright
7 notice and this notice are preserved. This file is offered as-is,
8 without any warranty. */
9
10 #include <config.h>
11
12 #include <stdio.h>
13 #include <string.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include "liblouis.h"
17 #include "internal.h"
18
19 int
20 main(int argc, char **argv)
21 {
22 int success = 0;
23 char * match;
24 char ** matches;
25 const char * tables[] = {"tests/tablesWithMetadata/foo","tests/tablesWithMetadata/bar",NULL};
26 lou_setLogLevel(LOU_LOG_DEBUG);
27 lou_indexTables(tables);
28 match = lou_findTable("id:foo");
29 success |= (!match || (strstr(match, "tablesWithMetadata/foo") == NULL));
30 free(match);
31 match = lou_findTable("language:en");
32 success |= (!match || (strstr(match, "tablesWithMetadata/bar") == NULL));
33 free(match);
34 matches = lou_findTables("language:en");
35 success |= (!matches || !matches[0] || (strstr(matches[0], "tablesWithMetadata/bar") == NULL));
36 success |= (!matches || !matches[0] || !matches[1] || (strstr(matches[1], "tablesWithMetadata/foo") == NULL));
37 if (matches) {
38 for (int i = 0; matches[i]; i++) free(matches[i]);
39 free(matches);
40 }
41 lou_free();
42 return success;
43 }