added tests for folding ( follow instruction issue #602 incorrect folding, now called collapse bug)