Debian Codegraph @

tests/getTable.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Copyright (C) 2012 James Teh <[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 "liblouis.h"
16
17 int
18 main(int argc, char **argv)
19 {
20 const char* goodTable = "tables/en-us-g1.ctb";
21 const char* badTable = "tests/tables/bad.ctb";
22 const void* table = NULL;
23 int result = 0;
24
25 table = lou_getTable(goodTable);
26 if (!table)
27 {
28 printf("Getting %s failed, expected success\n", goodTable);
29 result = 1;
30 }
31 else
32 table = NULL;
33
34 table = lou_getTable(badTable);
35 if (table)
36 {
37 printf("Getting %s succeeded, expected failure\n", badTable);
38 table = NULL;
39 result = 1;
40 }
41
42 table = lou_getTable(goodTable);
43 if (!table)
44 {
45 printf("Getting %s failed, expected success\n", goodTable);
46 result = 1;
47 }
48 else
49 table = NULL;
50
51 lou_free();
52
53 return result;
54 }