Add test setup and some basic functional test

This pull-request is based on #1 and #2, please check them first.