Rewrite tests using  function.