Adding unit test to on-the-fly codes