added tests for generate template swap function