Improved unit test for template