James Teh | 7dc0d92 | 2012-09-20 04:32:54 +0000 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <stdlib.h> |
| 4 | #include "liblouis.h" |
| 5 | |
| 6 | int |
| 7 | main(int argc, char **argv) |
| 8 | { |
| 9 | const char* goodTable = "en-us-g1.ctb"; |
| 10 | const char* badTable = "bad.ctb"; |
| 11 | void* table = NULL; |
| 12 | int result = 0; |
| 13 | |
| 14 | table = lou_getTable(goodTable); |
| 15 | if (!table) |
| 16 | { |
| 17 | printf("Getting %s failed, expected success\n", goodTable); |
| 18 | result = 1; |
| 19 | } |
| 20 | else |
| 21 | table = NULL; |
| 22 | |
| 23 | table = lou_getTable(badTable); |
| 24 | if (table) |
| 25 | { |
| 26 | printf("Getting %s succeeded, expected failure\n", badTable); |
| 27 | table = NULL; |
| 28 | result = 1; |
| 29 | } |
| 30 | |
| 31 | table = lou_getTable(goodTable); |
| 32 | if (!table) |
| 33 | { |
| 34 | printf("Getting %s failed, expected success\n", goodTable); |
| 35 | result = 1; |
| 36 | } |
| 37 | else |
| 38 | table = NULL; |
| 39 | |
| 40 | lou_free(); |
| 41 | |
| 42 | return result; |
| 43 | } |