Rewrite tests that got disabled by constant folding

Some tests become useless once constant folding has bee used. A few
bugfixes were found while disabling the optimization, I add them here
with a test case that prevents constant folding.
Merge pull request #194 from serge-sans-paille/more-test-cases

Rewrite tests that got disabled by constant folding