Add unit tests

Added unit tests in tests/ dir.
Run unit tests with make check, or
run each test with tests/test*.sh.
Use env KEEPFAIL=1 make check to preserve failed tests dirs.
USe env KEEPTEST=1 make check to preserve all tests dirs.
Use env DEBUG=1 make check to run teste with debug output.
Add TODO list