Refactor functional tests for table input

Now uses function to check table contents and thus removes code
duplication