#4: added and fixed unit tests for isValid
Closes #4.