Fix and refactor test code
Merge pull request #29 from ogail/test

Fix and refactor test code