Split off all possible cases into sub-tests, and add more thorough checks on the invalid strings unit.