Revision: 652 Author: christian.egli@xxxxxxxxxxxxxx Date: Thu May 31 06:55:01 2012Log: Added a test for the repeated opcode. Rumors had it that it was buggy,
but it does what it is supposed to. http://code.google.com/p/liblouis/source/detail?r=652 Added: /trunk/tests/repeated.c /trunk/tests/tables/repeated.utb /trunk/tests/tables/repeated_with_correct.utb Modified: /trunk/ChangeLog /trunk/tests /trunk/tests/Makefile.am /trunk/tests/tables/Makefile.am ======================================= --- /dev/null +++ /trunk/tests/repeated.c Thu May 31 06:55:01 2012 @@ -0,0 +1,102 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "brl_checks.h" + +int main(int argc, char **argv) +{ + + int result = 0; + const char *tests[] = { + /* first column is the text, the second is the expected value */ + " ", " ", + /* the usual case */ + " ", " ", + /* a very long string */+ " " \ + " " \ + " " \ + " " \ + " " \
+ " ", " ", + /* an even longer string */+ " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \
+ " ", " ", + /* a string containing tabs */ + " \t", " \t", + " \t ", " \t ", + "\t ", "\t ", + /* Strings containing newlines */ + " \n", " \n", + " \n ", " \n ", + "\n ", "\n " + }; + + const int tests_len = sizeof(tests)/sizeof(char*); + + for (int i = 0; i < tests_len; i += 2)+ result |= check_translation("repeated.utb", tests[i], NULL, tests[i+1]);
+ + const char *tests2[] = { + /* first column is the text, the second is the expected value */ + " ", " ", + /* the usual case */ + " ", " ", + /* a very long string */+ " " \ + " " \ + " " \ + " " \ + " " \
+ " ", " ", + /* an even longer string */+ " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \ + " " \
+ " ", " ", + /* a string containing tabs */ + " \t", " ", + " \t ", " ", + "\t ", " ", + /* Strings containing newlines */ + " \n", " ", + " \n ", " ", + "\n ", " ", + /* All mixed */ + " \n \t \n \t\t \n\n\n\t\t ", " ", + }; + + const int tests2_len = sizeof(tests2)/sizeof(char*); + + for (int i = 0; i < tests2_len; i += 2) {+ result |= check_translation("repeated_with_correct.utb", tests2[i], NULL, tests2[i+1]);
+ } + + return result; +} ======================================= --- /dev/null +++ /trunk/tests/tables/repeated.utb Thu May 31 06:55:01 2012 @@ -0,0 +1,4 @@ +space \t 9 +space \n 0 + +repeated \s 0 ======================================= --- /dev/null +++ /trunk/tests/tables/repeated_with_correct.utb Thu May 31 06:55:01 2012 @@ -0,0 +1,7 @@ +space \t 9 +space \n 0 + +correct "\t" " " +correct "\n" " " + +repeated \s 0 ======================================= --- /trunk/ChangeLog Thu May 31 06:34:24 2012 +++ /trunk/ChangeLog Thu May 31 06:55:01 2012 @@ -1,5 +1,13 @@ 2012-05-31 Christian Egli <christian.egli@xxxxxx> + * tests/Makefile.am: + * tests/repeated.c: + * tests/tables/Makefile.am: + * tests/tables/repeated.utb: + * tests/tables/repeated_with_correct.utb: Added a test for the + repeated opcode. Rumors had it that it was buggy, but it does what + it is supposed to. + * doc/liblouis.texi (The correct Opcode): Remove the comment about input and output positions being incorrect. This bug has been fixed. ======================================= --- /trunk/tests/Makefile.am Wed May 30 10:00:22 2012 +++ /trunk/tests/Makefile.am Thu May 31 06:55:01 2012 @@ -64,6 +64,11 @@ brl_checks.h \ uplow_with_unicode.c +repeated_SOURCES = \ + brl_checks.c \ + brl_checks.h \ + repeated.c + check_PROGRAMS = \ pass2 \ pass2_inpos \ @@ -76,7 +81,8 @@ inpos_compbrl \ lastworditalafter \ en_gb_g1_italics \ - letterDefTest + letterDefTest \ + repeated dist_check_SCRIPTS = \ check_all_tables.pl \ ======================================= --- /trunk/tests/tables/Makefile.am Mon Apr 30 21:18:51 2012 +++ /trunk/tests/tables/Makefile.am Thu May 31 06:55:01 2012 @@ -1,4 +1,17 @@ -EXTRA_DIST = \ +EXTRA_DIST = \ + inpos_match_replace.ctb \ + inpos_pass0.ctb \ + inpos_pass1.ctb \ + inpos_pass2.ctb \ + inpos_pass3.ctb \ letterDefTest.ctb \ - loop.ctb \ - pass2.ctb + letterDefTest_letter.ctb \ + letterDefTest_lowercase.ctb \ + letterDefTest_uplow.ctb \ + letterDefTest_uppercase.ctb \ + loop.ctb \ + lowercase_with_unicode.ctb \ + pass2.ctb \ + repeated.utb \ + repeated_with_correct.utb \ + uplow_with_unicode.ctb For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com