aboutsummaryrefslogtreecommitdiff
path: root/learn-you-some-erlang/tests/useless_tests.erl
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-02-23 07:08:18 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-02-23 07:08:18 +0100
commit5a9cdd3cc89507d4d74f8bded56ce5e037b3b56e (patch)
tree982ca2e7f9ac4e8c350dfb5c4f60bcfdfff5afaf /learn-you-some-erlang/tests/useless_tests.erl
parent05ae56e5e89abf2993f84e6d52b250131f247c35 (diff)
downloaderlang-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/tests/useless_tests.erl')
-rw-r--r--learn-you-some-erlang/tests/useless_tests.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/learn-you-some-erlang/tests/useless_tests.erl b/learn-you-some-erlang/tests/useless_tests.erl
new file mode 100644
index 0000000..8f174be
--- /dev/null
+++ b/learn-you-some-erlang/tests/useless_tests.erl
@@ -0,0 +1,18 @@
+-module(useless_tests).
+-include_lib("eunit/include/eunit.hrl").
+-test_warnings([hello_test/0]).
+
+add_test_() ->
+ [?_assertEqual(-5, useless:add(-3, -2)),
+ ?_assertEqual(4, useless:add(2, 2)),
+ ?_assertEqual(2.5, useless:add(2.0, 0.5)),
+ ?_assertEqual(1, useless:add(-3, 4))].
+
+hello_test() ->
+ ok. % no test possible for I/O. Curse you, side effects!
+
+greet_and_add_test_() ->
+ [?_assertEqual(useless:greet_and_add_two(-3), useless:add(-3, 2)),
+ ?_assertEqual(useless:greet_and_add_two(2), useless:add(2, 2)),
+ ?_assertEqual(useless:greet_and_add_two(0.5), useless:add(2, 0.5)),
+ ?_assertEqual(useless:greet_and_add_two(-3), useless:add(-3, 2))].