Skip to content

Instantly share code, notes, and snippets.

@barrym
Created June 15, 2009 20:59
Show Gist options
  • Save barrym/130337 to your computer and use it in GitHub Desktop.
Save barrym/130337 to your computer and use it in GitHub Desktop.
-module(utils).
-compile(export_all).
-ifdef(EUNIT).
-include_lib("eunit/include/eunit.hrl").
-endif.
double(X) ->
X * 2.
triple(X) ->
X * 3.
% Tests
-ifdef(EUNIT).
double_test_() ->
{inparallel,
[
?_assertEqual( 100, utils:double(50)),
?_assertEqual( 50, utils:double(20))
]
}.
triple_test_() ->
{inparallel,
[
?_assertEqual( 9, utils:triple(3)),
?_assertEqual( 75, utils:triple(25))
]
}.
-endif.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment