[liblouis-liblouisxml] [liblouis] r840 committed - Add a test for the combination correct + typeform...

  • From: liblouis@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 29 Nov 2012 14:18:34 +0000

Revision: 840
Author:   bertfrees@xxxxxxxxx
Date:     Thu Nov 29 06:18:13 2012
Log:      Add a test for the combination correct + typeform

Also fixed a bug in brl_checks.c: typeform argument was not copied properly
http://code.google.com/p/liblouis/source/detail?r=840

Added:
 /trunk/tests/pass0_typebuf.c
 /trunk/tests/tables/pass0_typebuf.ctb
Modified:
 /trunk/tests/Makefile.am
 /trunk/tests/brl_checks.c

=======================================
--- /dev/null
+++ /trunk/tests/pass0_typebuf.c        Thu Nov 29 06:18:13 2012
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "brl_checks.h"
+
+int
+main(int argc, char **argv)
+{
+    int i;
+
+    char* table = "pass0_typebuf.ctb";
+    char* text = "foo baz";
+    char* expected = "foobar .baz";
+    char* typeform = malloc(20 * sizeof(char));
+    for (i = 0; i < 7; i++)
+      typeform[i] = 0;
+    for (i = 4; i < 7; i++)
+      typeform[i] = 1;
+
+    if (!check_translation(table, text, typeform, expected))
+      return 0;
+
+    return 1;
+}
=======================================
--- /dev/null
+++ /trunk/tests/tables/pass0_typebuf.ctb       Thu Nov 29 06:18:13 2012
@@ -0,0 +1,31 @@
+uplow Aa 1
+uplow Bb 12
+uplow Cc 14
+uplow Dd 145
+uplow Ee 15
+uplow Ff 124
+uplow Gg 1245
+uplow Hh 125
+uplow Ii 24
+uplow Jj 245
+uplow Kk 13
+uplow Ll 123
+uplow Mm 134
+uplow Nn 1345
+uplow Oo 135
+uplow Pp 1234
+uplow Qq 12345
+uplow Rr 1235
+uplow Ss 234
+uplow Tt 2345
+uplow Uu 136
+uplow Vv 1236
+uplow Ww 2456
+uplow Xx 1346
+uplow Yy 13456
+uplow Zz 1356
+
+sign . 46
+lastworditalbefore 46
+
+correct "foo" "foobar"
=======================================
--- /trunk/tests/Makefile.am    Wed Oct 31 08:30:07 2012
+++ /trunk/tests/Makefile.am    Thu Nov 29 06:18:13 2012
@@ -88,8 +88,12 @@
 getTable_SOURCES = getTable.c

 typeform_SOURCES =                             \
-typeform.c
+       typeform.c

+pass0_typebuf_SOURCES =                        \
+       brl_checks.c                            \
+       brl_checks.h                            \
+       pass0_typebuf.c

 check_PROGRAMS =                               \
        pass2                                   \
@@ -109,7 +113,8 @@
        pass1Only                               \
        outpos                          \
        getTable \
-       typeform
+       typeform \
+       pass0_typebuf


 dist_check_SCRIPTS =           \
=======================================
--- /trunk/tests/brl_checks.c   Tue Sep 18 21:13:49 2012
+++ /trunk/tests/brl_checks.c   Thu Nov 29 06:18:13 2012
@@ -57,7 +57,7 @@
   if (typeform != NULL)
     {
       typeformbuf = malloc(outlen);
-      strcpy(typeformbuf, typeform);
+      memcpy(typeformbuf, typeform, outlen);
     }
   if (!extParseChars(str, inbuf))
     {
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] [liblouis] r840 committed - Add a test for the combination correct + typeform... - liblouis