add function+filter test helpers and refactor to use them