refactoring: move auxilary functions from tests.c to testutils.c