version-parsing improvements and tests

Ought to fix #21, #28, #42. Intended to obsolete @kentfredric's very helpful #113.