Add unit test for debug function