Debian Codegraph @

tests/check_metadata.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Copyright (C) 2016 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
18 static int errorCount = 0;
19
20 static void
21 log_and_count_errors(logLevels level, const char *message)
22 {
23 switch(level)
24 {
25 case LOU_LOG_ERROR:
26 errorCount++;
27 printf("\n ERROR >> %s\n", message);
28 break;
29 default:
30 printf("%s\n", message);
31 }
32 }
33
34 int
35 main(int argc, char **argv)
36 {
37 lou_registerLogCallback(log_and_count_errors);
38 lou_setLogLevel(LOU_LOG_DEBUG);
39 char table_path[2048];
40 const char *abs_top_srcdir = getenv ("LOUIS_TABLEPATH");
41 sprintf (table_path, "%s/tables", abs_top_srcdir);
42 setenv ("LOUIS_TABLEPATH", table_path, 1);
43 errorCount = 0;
44 lou_findTable("bo:gus"); // because lou_indexTables hasn't been called, this
45 // command will implicitly index all tables on the
46 // table path, and produce errors when it
47 // encounters invalid metadata statements.
48 return errorCount;
49 }