Add some unit tests

@slinkp's code