Debian Codegraph @

tests/charToFallbackDots.c

raw symbols SCIP
1 /* liblouis Braille Translation and Back-Translation Library
2
3 Copyright (C) 2019 Bert Frees
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 "internal.h"
16
17 // Test that the _lou_charToFallbackDots has the same behavior as the NABCC table for the ASCII range
18 int main (int argc, char **argv) {
19 const DisplayTableHeader* table = _lou_getDisplayTable("tables/text_nabcc.dis");
20 widechar c;
21 for (c = 0; c < 0x85; c++) {
22 widechar d1 = _lou_charToFallbackDots(c);
23 widechar d2 = _lou_getDotsForChar(c < 0x80 ? c : '?', table);
24 if (d1 != d2) {
25 fprintf(stderr, "_lou_charToFallbackDots(%s) expected to return %s but got %s\n",
26 strdup(_lou_showString(&c, 1, 1)),
27 strdup(_lou_showDots(&d2, 1)),
28 strdup(_lou_showDots(&d1, 1)));
29 lou_free();
30 return 1;
31 }
32 }
33 lou_free();
34 return 0;
35 }