Add test cases.

Also enabled travis ci.