Revision: 617 Author: bertfrees@xxxxxxxxx Date: Mon May 14 05:22:01 2012 Log: Added tests for inputPos http://code.google.com/p/liblouis/source/detail?r=617 Added: /trunk/tests/inpos.c /trunk/tests/tables/inpos_pass0.ctb /trunk/tests/tables/inpos_pass1.ctb /trunk/tests/tables/inpos_pass2.ctb /trunk/tests/tables/inpos_pass3.ctb Modified: /trunk/tests/Makefile.am ======================================= --- /dev/null +++ /trunk/tests/inpos.c Mon May 14 05:22:01 2012 @@ -0,0 +1,53 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "brl_checks.h" + +int +main(int argc, char **argv) +{ + +/* input aaabcd ef g + 012345 67 8 + pass0 a bcddef g + 0 345567 8 + pass1 x cddw g + 0 4556 8 + pass2 zy dw g + 00 56 8 + pass3 zy deeeg + 00 56668 +*/ + + int result = 0; + + const char* txt = "aaabcdefg"; + + const char* table1 = "inpos_pass0.ctb"; + const char* table2 = "inpos_pass0.ctb,inpos_pass1.ctb"; + const char* table3 = "inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb";+ const char* table4 = "inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb,inpos_pass3.ctb";
+ + const char* brl1 = "abcddefg"; + const char* brl2 = "xcddwg"; + const char* brl3 = "zydwg"; + const char* brl4 = "zydeeeg"; + + const int inpos1[] = {0,3,4,5,5,6,7,8}; + const int inpos2[] = {0,4,5,5,6,8}; + const int inpos3[] = {0,0,5,6,8}; + const int inpos4[] = {0,0,5,6,6,6,8}; + + result |= check_inpos(table1, txt, inpos1); + result |= check_inpos(table2, txt, inpos2); + result |= check_inpos(table3, txt, inpos3); + result |= check_inpos(table4, txt, inpos4); + + result |= check_translation(table1, txt, NULL, brl1); + result |= check_translation(table2, txt, NULL, brl2); + result |= check_translation(table3, txt, NULL, brl3); + result |= check_translation(table4, txt, NULL, brl4); + + return result; + +} ======================================= --- /dev/null +++ /trunk/tests/tables/inpos_pass0.ctb Mon May 14 05:22:01 2012 @@ -0,0 +1,16 @@ +sign a 1 +sign b 2 +sign c 3 +sign d 4 +sign e 5 +sign f 6 +sign g 7 +sign w 13 +sign x 12 +sign y 34 +sign z 56 + +correct ["aaa"] "a" +correct ["d"] "dd" + + ======================================= --- /dev/null +++ /trunk/tests/tables/inpos_pass1.ctb Mon May 14 05:22:01 2012 @@ -0,0 +1,4 @@ +context ["ab"] @12 + +always ef 13 + ======================================= --- /dev/null +++ /trunk/tests/tables/inpos_pass2.ctb Mon May 14 05:22:01 2012 @@ -0,0 +1,3 @@ +pass2 @12-3-4 @56-34 + + ======================================= --- /dev/null +++ /trunk/tests/tables/inpos_pass3.ctb Mon May 14 05:22:01 2012 @@ -0,0 +1,3 @@ +pass3 [@13] @5-5-5 +#pass3 @4[@13] @5-5-5 # This is still a bug + ======================================= --- /trunk/tests/Makefile.am Mon May 7 05:46:39 2012 +++ /trunk/tests/Makefile.am Mon May 14 05:22:01 2012 @@ -44,6 +44,11 @@ brl_checks.h \ pass2_inpos.c +inpos_SOURCES = \ + brl_checks.c \ + brl_checks.h \ + inpos.c + letterDefTest_SOURCES = \ brl_checks.c \ brl_checks.h \ @@ -57,6 +62,7 @@ check_PROGRAMS = \ pass2 \ pass2_inpos \ + inpos \ uplow_with_unicode \ present_progressive \ capitalized_word \ For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com