Added unit test code, checking edge cases.