Add unit tests for some functions