Revision: 577 Author: christian.egli@xxxxxxxxxxxxxx Date: Wed Apr 18 13:36:21 2012Log: Rename check_outpos to check_inpos to reflect the true intention of
the function and the test. http://code.google.com/p/liblouis/source/detail?r=577 Added: /trunk/tests/pass2_inpos.c Deleted: /trunk/tests/pass2_outpos.c Modified: /trunk/ChangeLog /trunk/tests/Makefile.am /trunk/tests/brl_checks.c /trunk/tests/brl_checks.h /trunk/tests/inpos_compbrl.c ======================================= --- /dev/null +++ /trunk/tests/pass2_inpos.c Wed Apr 18 13:36:21 2012 @@ -0,0 +1,36 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "brl_checks.h" + +int +main(int argc, char **argv) +{ + + const char* table = "pass2.ctb"; + + int result = 0; + + /* First check a plain word to see if inpos handling generally + works */ + const char* str1 = "Rene"; + const int expected_inpos1[] = {0,1,2,3,3}; + + result |= check_inpos(table, str1, expected_inpos1); + + /* then try a word which uses pass2 and makes the output longer */ + const char* str2 = "Reno"; + const int expected_inpos2[] = {0,1,2,3,3}; + + result |= check_inpos(table, str2, expected_inpos2); + + /* finally try a word also uses pass2, deletes a char from the + output and essentially shortens the output */ + const char* str3 = "xRen"; + const int expected_inpos3[] = {1,2,3}; + + result |= check_inpos(table, str3, expected_inpos3); + + return result; + +} ======================================= --- /trunk/tests/pass2_outpos.c Fri Apr 13 05:45:35 2012 +++ /dev/null @@ -1,36 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include "brl_checks.h" - -int -main(int argc, char **argv) -{ - - const char* table = "pass2.ctb"; - - int result = 0; - - /* First check a plain word to see if outpos handling generally - works */ - const char* str1 = "Rene"; - const int expected_outpos1[] = {0,1,2,3,3}; - - result |= check_outpos(table, str1, expected_outpos1); - - /* then try a word which uses pass2 and makes the output longer */ - const char* str2 = "Reno"; - const int expected_pos2[] = {0,1,2,3,3}; - - result |= check_outpos(table, str2, expected_pos2); - - /* finally try a word also uses pass2, deletes a char from the - output and essentially shortens the output */ - const char* str3 = "xRen"; - const int expected_pos3[] = {1,2,3}; - - result |= check_outpos(table, str3, expected_pos3); - - return result; - -} ======================================= --- /trunk/ChangeLog Tue Apr 17 02:35:31 2012 +++ /trunk/ChangeLog Wed Apr 18 13:36:21 2012 @@ -1,3 +1,17 @@ +2012-04-18 Christian Egli <christian.egli@xxxxxx> + + + + * tests/pass2_outpos.c: + * tests/pass2_inpos.c: Rename test to reflect what it really + tests. + + * tests/Makefile.am: + * tests/brl_checks.h: + * tests/brl_checks.c (check_inpos): + * tests/inpos_compbrl.c: Rename check_outpos to check_inpos to + reflect the true intention of the function. + 2012-04-17 Christian Egli <christian.egli@xxxxxx> * tests/doctests/en-GB-g2.ctb_test.txt: ======================================= --- /trunk/tests/Makefile.am Tue Apr 17 01:13:59 2012 +++ /trunk/tests/Makefile.am Wed Apr 18 13:36:21 2012 @@ -39,10 +39,10 @@ brl_checks.h \ pass2.c -pass2_outpos_SOURCES = \ +pass2_inpos_SOURCES = \ brl_checks.c \ brl_checks.h \ - pass2_outpos.c + pass2_inpos.c letterDefTest_SOURCES = \ brl_checks.c \ @@ -51,7 +51,7 @@ check_PROGRAMS = \ pass2 \ - pass2_outpos \ + pass2_inpos \ present_progressive \ capitalized_word \ capitalized_with_sentance \ ======================================= --- /trunk/tests/brl_checks.c Fri Apr 13 05:16:37 2012 +++ /trunk/tests/brl_checks.c Wed Apr 18 13:36:21 2012 @@ -95,7 +95,7 @@ } int-check_outpos(const char *tableList, const char *str, const int *expected_poslist) +check_inpos(const char *tableList, const char *str, const int *expected_poslist)
{ widechar *inbuf; widechar *outbuf; @@ -109,13 +109,12 @@ inbuf = malloc(sizeof(widechar) * inlen); outbuf = malloc(sizeof(widechar) * outlen); inpos = malloc(sizeof(int) * inlen); - outpos = malloc(sizeof(int) * inlen); for (i = 0; i < inlen; i++) { inbuf[i] = str[i]; } lou_translate(tableList, inbuf, &inlen, outbuf, &outlen, - NULL, NULL, outpos, inpos, NULL, 0); + NULL, NULL, NULL, inpos, NULL, 0); for (i = 0; i < outlen; i++) { if (expected_poslist[i] != inpos[i]) @@ -129,7 +128,6 @@ free(inbuf); free(outbuf); free(inpos); - free(outpos); lou_free(); return rv; ======================================= --- /trunk/tests/brl_checks.h Fri Apr 13 05:16:37 2012 +++ /trunk/tests/brl_checks.h Wed Apr 18 13:36:21 2012 @@ -1,6 +1,6 @@ #define TRANSLATION_TABLE "en-us-g2.ctb"-int check_outpos(const char *tableList, const char *str, const int *expected_poslist); +int check_inpos(const char *tableList, const char *str, const int *expected_poslist);
/* Check if the cursor position is where you expect it to be after translating str. Return 0 if the translation is as expected and 1 ======================================= --- /trunk/tests/inpos_compbrl.c Fri Apr 13 05:18:42 2012 +++ /trunk/tests/inpos_compbrl.c Wed Apr 18 13:36:21 2012 @@ -9,5 +9,5 @@ const char *str1 = "user@xxxxxxxxxxx"; const int expected_inpos[] = {0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,15,15}; - return check_outpos(TRANSLATION_TABLE, str1, expected_inpos); -} + return check_inpos(TRANSLATION_TABLE, str1, expected_inpos); +} For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com