Added a test of valiateOutput and simplify a bit

Add some tests of the validateOutput helper.