basictypes: fix an error when input string is empty

Thanks to Charles Bueche for detecting this bug. The format was parsed
only if the string was not empty. When the string is empty, we separator
and terminal character were not known and this raised an exception. Add
a unittest to avoid this case in the future.