add composite validity tests

also add testing covering all functions, although because of the nature
of the code structure (using a long switch statement), it's not
practical to get 100% test coverage.

updated readme