Revision: 584 Author: mesar.hameed Date: Mon Apr 30 01:21:56 2012 Log: moved tables/letterDefTest.ctb to tests/tables/letterDefTest.ctb. Corrected tests/letterDefTest.c to test for unicode problems. http://code.google.com/p/liblouis/source/detail?r=584 Added: /trunk/tests/tables/letterDefTest.ctb Deleted: /trunk/tables/letterDefTest.ctb Modified: /trunk/tests/letterDefTest.c ======================================= --- /dev/null +++ /trunk/tests/tables/letterDefTest.ctb Mon Apr 30 01:21:56 2012 @@ -0,0 +1,24 @@ +# define dot mappings + +## Note: at any given time, only 3 opCodes should be defined in this table.+## This table is to illustrate the internal treatment of various letter definitions.
+ +## this works. +#uplow \x2804\x280d 134 +#uplow \x280e\x280e 234 + +## the following does not work. +letter \x280d 134 +letter \x280e 234 + +## neither does this: +#lowercase \x280d 134 +#lowercase \x280e 234 + +## doesnt work either: +#uppercase \x280d 134 +#uppercase \x280e 234 + +## small test to show that always opcode works.+## tests/harness/letterDefinition_harness.py expects 'ms' to be 'sm' in braille.
+always \x280d\x280e 234-134 ======================================= --- /trunk/tables/letterDefTest.ctb Fri Apr 13 09:21:25 2012 +++ /dev/null @@ -1,24 +0,0 @@ -# define dot mappings - -## Note: at any given time, only 3 opCodes should be defined in this table.-## This table is to illustrate the internal treatment of various letter definitions.
- -## this works. -#uplow \x2804\x280d 134 -#uplow \x280e\x280e 234 - -## the following does not work. -letter \x280d 134 -letter \x280e 234 - -## neither does this: -#lowercase \x280d 134 -#lowercase \x280e 234 - -## doesnt work either: -#uppercase \x280d 134 -#uppercase \x280e 234 - -## small test to show that always opcode works.-## tests/harness/letterDefinition_harness.py expects 'ms' to be 'sm' in braille.
-always \x280d\x280e 234-134 ======================================= --- /trunk/tests/letterDefTest.c Wed Mar 28 03:42:01 2012 +++ /trunk/tests/letterDefTest.c Mon Apr 30 01:21:56 2012 @@ -1,14 +1,38 @@ +#include <locale.h> #include <stdio.h> #include <string.h> #include <stdlib.h> -#include "brl_checks.h" - -int -main(int argc, char **argv) -{ - - int result = 0; -- result = check_translation("letterDefTest.ctb", "ms", NULL, "\x280e\x280d");
- return result; -} +#include <wchar.h> +#include "liblouis.h" + +int main(int argc, char **argv) { + wchar_t *text = L"⠍⠎"; + wchar_t *expected = L"⠎⠍"; + const char* tableList = "./tables/letterDefTest.ctb"; + setlocale(LC_ALL, "en_GB.UTF-8"); + + wchar_t *inbuf; + wchar_t *outbuf; + int inlen; + int outlen; + int i = 0; + int expectedlen = strlen(expected); + inlen = strlen(text) * 2; + outlen = inlen; + inbuf = malloc(sizeof(wchar_t) * inlen); + outbuf = malloc(sizeof(wchar_t) * outlen); + printf("%ls\n", text); + for (i = 0; i < inlen; i++) { + inbuf[i] = text[i]; + } + if (!lou_translate(tableList, inbuf, &inlen, outbuf, &outlen, + NULL, NULL, NULL, NULL, NULL, 0)) { + printf("Translation failed.\n"); + return 1; + } + printf("%ls\n", outbuf); + free(inbuf); + free(outbuf); + lou_free(); + return 0; +}