blob: 3365ef0e02a2875323d6b9db5018d802e8499ce1 [file] [log] [blame]
Christian Eglib6698722016-12-01 12:24:18 +01001/* liblouis Braille Translation and Back-Translation Library
2
3Copyright (C) 2015 Bert Frees <bertfrees@gmail.com>
4
5Copying and distribution of this file, with or without modification,
6are permitted in any medium without royalty provided the copyright
7notice and this notice are preserved. This file is offered as-is,
8without any warranty. */
9
Christian Egli26fabec2015-09-11 16:28:40 +020010#include <config.h>
Bert Frees111e7022015-02-10 12:57:05 +010011#include <stdio.h>
12#include <string.h>
13#include <stdlib.h>
14#include <unistd.h>
Christian Eglib5bcac12015-08-19 11:16:09 +020015#include "liblouis.h"
Davy Kagerff52a4f2017-04-26 22:01:10 +020016#include "internal.h"
Bert Frees111e7022015-02-10 12:57:05 +010017
18int
19main(int argc, char **argv)
20{
21 int success = 0;
22 char * match;
Bert Frees84f9dbf2017-11-12 22:38:01 +010023 char ** matches;
Christian Egli95539602016-10-06 17:26:42 +020024 const char * tables[] = {"tests/tablesWithMetadata/foo","tests/tablesWithMetadata/bar",NULL};
Christian Egli547815d2019-03-04 09:46:51 +010025 lou_setLogLevel(LOU_LOG_DEBUG);
Bert Frees17a7ad12015-03-09 20:41:05 +010026 lou_indexTables(tables);
Bert Frees111e7022015-02-10 12:57:05 +010027 match = lou_findTable("id:foo");
Christian Egli2942c1b2015-05-29 14:11:11 +020028 success |= (!match || (strstr(match, "tablesWithMetadata/foo") == NULL));
Bert Frees111e7022015-02-10 12:57:05 +010029 match = lou_findTable("language:en");
Christian Egli2942c1b2015-05-29 14:11:11 +020030 success |= (!match || (strstr(match, "tablesWithMetadata/bar") == NULL));
Bert Frees84f9dbf2017-11-12 22:38:01 +010031 matches = lou_findTables("language:en");
32 success |= (!matches || !matches[0] || (strstr(matches[0], "tablesWithMetadata/bar") == NULL));
33 success |= (!matches || !matches[0] || !matches[1] || (strstr(matches[1], "tablesWithMetadata/foo") == NULL));
Christian Eglib5bcac12015-08-19 11:16:09 +020034 lou_free();
Bert Frees111e7022015-02-10 12:57:05 +010035 return success;
36}