[Tests] Fix some problems with testiteratorranges

- Add missing constant 'dim' to check_ranges()
- capture output stream with universal reference in check_yasp_3d
  (avoids compiler error complaining about binding temporary to lvalue
  reference)
- Switch to new, universal YaspGrid constructor to avoid deprecation warning