[TIP] Test coverage and parsing.

Olemis Lang olemis at gmail.com
Tue Jul 28 09:00:05 PDT 2009

Hello !

This time I have an interesting (at least for me ;o) question. I'm
developing a parser (in fact a few parsers for CFLs), and I want to
write tests to ensure that it works OK. I mean I'd like to generate
expressions to cover all the «interesting» (yes still fuzzy in my head
;o) valid expressions (and maybe some invalid expressions) in order to
ensure that the parser works correctly.

AFAICS it seems that traditional test coverage is useless in this case
since code doesnt reflect the complexity and details of the target
language (e.g. all you need to parse something is something like
`parse("my glorious expression")` ) and I dont want to test exactly
the code, but the conformance to the rules of the CFG (i.e. the code
may behave OK and be fully tested, but doesnt handle all the rules
appropriately ;o).

How could I do that ? Do you have any suggestions or know any tool for
doing this ?

Thanks in advance !



Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

More information about the testing-in-python mailing list