unit test for folding