Merge pull request #414 from tzz/feature/api-selftest

cf-dc-api.pl: add validation selftest that tests a strict array
cf-dc-api.pl: restructure selftests and log better; add more selftests