diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2024-02-23 07:08:18 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2024-02-23 07:08:18 +0100 |
commit | 5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e (patch) | |
tree | 982ca2e7f9ac4e8c350dfb5c4f60bcfdfff5afaf /learn-you-some-erlang/ops_tests.erl | |
parent | 05ae56e5e89abf2993f84e6d52b250131f247c35 (diff) | |
download | erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.gz erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.bz2 erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.tar.xz erlang-workshop-5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e.zip |
wip
Diffstat (limited to 'learn-you-some-erlang/ops_tests.erl')
-rw-r--r-- | learn-you-some-erlang/ops_tests.erl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/learn-you-some-erlang/ops_tests.erl b/learn-you-some-erlang/ops_tests.erl new file mode 100644 index 0000000..53323cf --- /dev/null +++ b/learn-you-some-erlang/ops_tests.erl @@ -0,0 +1,25 @@ +-module(ops_tests). +-include_lib("eunit/include/eunit.hrl"). + +add_test() -> + 4 = ops:add(2,2). + +new_add_test() -> + ?assertEqual(4, ops:add(2,2)), + ?assertEqual(3, ops:add(1,2)), + ?assert(is_number(ops:add(1,2))), + ?assertEqual(3, ops:add(1,1)), + ?assertError(badarith, 1/0). + +add_test_() -> + [test_them_types(), + test_them_values(), + ?_assertError(badarith, 1/0)]. + +test_them_types() -> + ?_assert(is_number(ops:add(1,2))). + +test_them_values() -> + [?_assertEqual(4, ops:add(2,2)), + ?_assertEqual(3, ops:add(1,2)), + ?_assertEqual(3, ops:add(1,1))]. |