test for flatten func