fix test
remove some code duplication
always create a new IntNode for the step value in iter-range optimisation as we overwrite its value later
tighten reversed-range iteration test