[tests] add initial unit tests
[tests] add a functional test case
for now need to run manually