aboutsummaryrefslogtreecommitdiff
path: root/learn-you-some-erlang/tests/oop_tests.erl
diff options
context:
space:
mode:
Diffstat (limited to 'learn-you-some-erlang/tests/oop_tests.erl')
-rw-r--r--learn-you-some-erlang/tests/oop_tests.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/learn-you-some-erlang/tests/oop_tests.erl b/learn-you-some-erlang/tests/oop_tests.erl
new file mode 100644
index 0000000..6ea444a
--- /dev/null
+++ b/learn-you-some-erlang/tests/oop_tests.erl
@@ -0,0 +1,16 @@
+-module(oop_tests).
+-include_lib("eunit/include/eunit.hrl").
+
+shell_test_() ->
+ Bird = oop:animal("Bird"),
+ Dog = oop:dog("Raptor-Dog"),
+ Cat = oop:cat("Sgt. McMittens"),
+ [?_assertEqual("living thing", Bird(type)),
+ ?_assertEqual("Bird eats worm", Bird({eat, "worm"})),
+ ?_assertEqual("Raptor-Dog says: Woof!", Dog(talk)),
+ ?_assertEqual("Raptor-Dog", Dog(name)),
+ ?_assertEqual("cat", Cat(type)),
+ ?_assertEqual("Raptor-Dog chases a cat named Sgt. McMittens around",
+ Dog({chase, Cat})),
+ ?_assertEqual("I'm sorry Dave, I can't do that.", Cat({play, "yarn"}))].
+