Test refactoring

Small test refactoring in preparation for fixing #1200
Add count in middle support for << and >>

Add the count in the middle support for the << and >> commands.

close #1200