rewrite tests generator