Added tests.

* Tests from @epidemian, thanks!