add test for factorial loop