cf-dc-api.pl: restructure selftests and log better; add more selftests
Merge pull request #415 from tzz/feature/api-selftest

cf-dc-api.pl: restructure selftests and log better; add more selftests