Re-factor tests

Now use two modes for each tests with a function, instead of repeating the same test twice