tests: MSVC compat

MSVC doesn't like declaring variables in the middle of a block, so we
need to wrap the equality check in a do-while block.