Add testcases for #38 and closes #37.

Signed-off-by: crynobone <crynobone@gmail.com>