Add a test for issue #78

https://github.com/liblouis/liblouis/issues/78
diff --git a/.gitignore b/.gitignore
index 81c9179..db5562c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -143,6 +143,7 @@
 /tests/typeform
 /tests/uplow_with_unicode
 /tests/logging
+/tests/compbrlAtCursor
 
 # /tests/doctests/
 /tests/doctests/Makefile
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fb09c5d..a761d2c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -130,6 +130,9 @@
 logging_SOURCES =				\
 	logging.c
 
+compbrlAtCursor_SOURCES =				\
+	compbrlAtCursor.c
+
 # Note that this is not currently included in check_programs below
 # otherwise make check would never complete.
 infiniteTranslationLoop_SOURCES =				\
@@ -164,7 +167,8 @@
 	pass0_typebuf				\
 	hash_collision                          \
 	resolve_table                          \
-	logging
+	logging                          \
+	compbrlAtCursor
 
 
 dist_check_SCRIPTS =		\
diff --git a/tests/compbrlAtCursor.c b/tests/compbrlAtCursor.c
new file mode 100644
index 0000000..4019a38
--- /dev/null
+++ b/tests/compbrlAtCursor.c
@@ -0,0 +1,84 @@
+// https://github.com/liblouis/liblouis/issues/78
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "louis.h"
+
+void
+print_widechars(widechar * buf, int len)
+{
+  int i;
+  for (i = 0; i < len; i++)
+    printf("%c", buf[i]);
+}
+
+int
+check_translation(const char *table, const char *input, int cursorPos, int mode, const char *expected)
+{
+  widechar *inbuf;
+  widechar *outbuf;
+  int inlen;
+  int outlen;
+  int i, rv = 0;
+  int expectedlen = strlen(expected);
+  inlen = strlen(input);
+  outlen = inlen * 10;
+  inbuf = malloc(sizeof(widechar) * inlen);
+  outbuf = malloc(sizeof(widechar) * outlen);
+  inlen = extParseChars(input, inbuf);
+  if (!inlen)
+    {
+      printf("Cannot parse input string.\n");
+      return 1;
+    }
+  if (!lou_translate(table, inbuf, &inlen, outbuf, &outlen,
+		     NULL, NULL, NULL, NULL, &cursorPos, mode))
+    {
+      printf("Translation failed.\n");
+      return 1;
+    }
+  for (i = 0; i < outlen && i < expectedlen && expected[i] == outbuf[i]; i++);
+  if (i < outlen || i < expectedlen)
+    {
+      rv = 1;
+      outbuf[outlen] = 0;
+      printf("Input: '%s'\n", input);
+      printf("Expected: '%s'\n", expected);
+      printf("Received: '");
+      print_widechars(outbuf, outlen);
+      printf("'\n");
+      if (i < outlen && i < expectedlen)
+	{
+	  printf("Diff: Expected '%c' but recieved '%c' in index %d\n",
+		 expected[i], outbuf[i], i);
+	}
+      else if (i < expectedlen)
+	{
+	  printf("Diff: Expected '%c' but recieved nothing in index %d\n",
+		 expected[i], i);
+	}
+      else
+	{
+	  printf("Diff: Expected nothing but recieved '%c' in index %d\n",
+		 outbuf[i], i);
+	}
+    }
+  free(inbuf);
+  free(outbuf);
+  lou_free();
+  return rv;
+}
+
+int
+main (int argc, char **argv)
+{
+  const char* table = "en-us-comp8.ctb,braille-patterns.cti";
+  const char* input = "héllo";
+  const char* expected = "h'\\x00e9'llo";
+  translationModes mode = compbrlAtCursor;
+  int result = 0;
+  result |= check_translation(table, input, 0, mode, expected);
+  result |= check_translation(table, input, 1, mode, expected);
+  return result;
+}