Hardened string generators and added tests.

Make sure that strings cannot be created with invalid length paramaters
and added tests.