Rewrite foldl in the test suite