This common function should go into a header file and be included.  I think these main files can be actually auto-generated from the test cases desired.  We can do this refactoring later.  Please file an issue for this.