| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 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 |
} |