[liblouis-liblouisxml] Re: proposal for a test harness

  • From: Mesar Hameed <mesar.hameed@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Thu, 1 Mar 2012 11:20:56 +0000

Hi Christian,

All the options you gave yesterday and your example today is far more verbose 
than my implementation.

Please have a look at the amount of duplication in the doctest example that you 
have given, this would 
grow as tests were added. All it is doing is unrolling the test loop forcing 
the user to type everything 
by hand. You can write out the three tests given in en-gb-g2_harness.py, in the 
doctest format, get a 
character and line count of each file and compare.
Same goes for the other formats you suggested yesterday.

The only reason why I wanted a harness to be included was so that we could 
submit test cases to help 
locating small and precise bugs.

If we cant agree on something workable I am happy to drop the request, and deal 
with things locally as 
best as I can.

Thanks,
Mesar
On Thu 01/03/12,11:58, Christian Egli wrote:
> Hi Mesar
> 
> Mesar Hameed <mesar.hameed@xxxxxxxxx> writes:
> 
> > Ok, please find attached, liblouis is now imported directly from source.
> 
> Here's a followup to my post from yesterday. I implemented your test as
> doctest and I like it quite a bit. It is quite concise, yet verbose and
> I think it can easily be undertood by an author of braille tables. An
> example is attached. Save the file in the test dir and run the tests as
> follows:
> 
> python -m doctest -v tests.txt
> 
> Thanks
> Christian
> 

> Liblouis tests
> ==============
> 
> This is an example test file in reStructuredText format. First import
> the ``louis`` module:
> 
>     >>> import sys
>     >>> sys.path.insert(1, "../python/")
>     >>> import louis
> 
> Then define the table you want to test
> 
>     >>> tables = ['en-GB-g2.ctb']
> 
> Now do some tests.
> 
> Check that "the" is correctly contracted
>     >>> louis.translateString(tables, 'the cat sat on the mat')
>     u'! cat sat on ! mat'
> 
> Make sure that "to" is contracted correctly and joined to next word.
>     >>> louis.translateString(tables, 'to the moon')
>     u'6! moon'
> 
> Check that "to" at end of line doesn't get contracted, and that "went"
> is expanded when cursor is positioned within the word. ``translate``
> returns a tuple where the first element contains the contracted
> braille and the fourth element contains the position of the cursor in
> the output
>     >>> louis.translate(tables, 'you went to', cursorPos=4, 
> mode=louis.compbrlAtCursor)[0]
>     u'y went to'
>     >>> louis.translate(tables, 'you went to', cursorPos=4, 
> mode=louis.compbrlAtCursor)[3]
>     2

> 
> -- 
> 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

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: