Enhanced testing

The test suite now checks whether a given input element matched a specified
rule.  This closes #6.