blob: 3da9de299cb219e56f05b95f7a29c18bd9ab5a58 [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));
Samuel Thibault62dad392022-03-25 20:35:46 +010029 free(match);
Bert Frees111e7022015-02-10 12:57:05 +010030 match = lou_findTable("language:en");
Christian Egli2942c1b2015-05-29 14:11:11 +020031 success |= (!match || (strstr(match, "tablesWithMetadata/bar") == NULL));
Samuel Thibault62dad392022-03-25 20:35:46 +010032 free(match);
Bert Frees84f9dbf2017-11-12 22:38:01 +010033 matches = lou_findTables("language:en");
34 success |= (!matches || !matches[0] || (strstr(matches[0], "tablesWithMetadata/bar") == NULL));
35 success |= (!matches || !matches[0] || !matches[1] || (strstr(matches[1], "tablesWithMetadata/foo") == NULL));
Samuel Thibault62dad392022-03-25 20:35:46 +010036 if (matches) {
37 for (int i = 0; matches[i]; i++) free(matches[i]);
38 free(matches);
39 }
Christian Eglib5bcac12015-08-19 11:16:09 +020040 lou_free();
Bert Frees111e7022015-02-10 12:57:05 +010041 return success;
42}