Add unit tests for diff function