[liblouis-liblouisxml] Re: Test Harness for liblouis

  • From: Christian Egli <christian.egli@xxxxxx>
  • To: Mesar Hameed <mesar.hameed@xxxxxxxxx>
  • Date: Wed, 29 Feb 2012 12:37:45 +0100

Hi all

Mesar Hameed <mesar.hameed@xxxxxxxxx> writes:
> Please find attached patch that includes the updated harness.

Really cool stuff!

Mesar and I had a lengthy discussion in irc about the test harness. I
prefer a simple format to express the tests. For complicated tests you
can always use Python unit tests. I experimented with a csv file and the
standard csv reader can easily parse these. An example test file is
attached. We need to agree on a simple delimiter to separate fields
which is unlikely to occur in the input data and in the output
(otherwise all the data has to be quoted). The data can easily be parsed
with the csv module and fed into the test harness like so:

import csv
reader = csv.reader(open("foo.csv", "rb"), delimiter=',', skipinitialspace=True)
for row in reader: print row

# these tests are expressed in the style of a csv. Empty lines and lines 
starting with '#' are ignored
# the first row is the text input. The second row is the expected braille output
# the optional third row is a python dict to pass additional params

# check that "the" is correctly contracted
the cat sat on the mat, ! cat sat on ! mat

# Checking "to" is contracted correctly and joined to next word.
to the moon, 6! moon

# Check that "to" at end of line doesnt get contracted, and that "went" is 
expanded when cursor is positioned within the word.
you went to, y went to, {mode: louis.compbrlAtCursor, cursorPos: 4, 
BRLCursorPos: 2}
> 1. should the expected braille be unicode braille chars, or is the
> ascii-braille ok?

I would think that the expected braille should be ascii-braille. The
users around here seem to like that best.


-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland


-----
Jetzt kostenlos eidgenoessische und kantonale Abstimmungsunterlagen aus 17 
Kantonen
zum Hoeren auf CD abonnieren: medienverlag@xxxxxx

Other related posts: