rewrite tests in erlang