Foldindices

Issue #1453 I put the tests into one file.