Move testcases out into separate functions.