ctype: tests and reorganize
Wrote tests for the functions implemented in 40558b26 and maybe made that test a little more comprehensible. Also fixed a few dumb mistakes in the implementations of those functions.
Also made sure that fmt.sh and test.sh were being executed by bash all the time (compatibility with other shells).
Sorry for the git mess :/