Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved ec_talk tests into separate file #185

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions src/ec_talk.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
say/1,
say/2]).

-ifdef(TEST).
-export([get_boolean/1,
get_integer/1]).
ariel-anieli marked this conversation as resolved.
Show resolved Hide resolved
-endif.

-export_type([prompt/0,
type/0,
supported/0]).
Expand Down Expand Up @@ -196,26 +201,3 @@ get_string(String) ->
false ->
no_clue
end.

%%%====================================================================
%%% tests
%%%====================================================================
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

general_test_() ->
[?_test(42 == get_integer("42")),
?_test(500_211 == get_integer("500211")),
?_test(1_234_567_890 == get_integer("1234567890")),
?_test(12_345_678_901_234_567_890 == get_integer("12345678901234567890")),
?_test(true == get_boolean("true")),
?_test(false == get_boolean("false")),
?_test(true == get_boolean("Ok")),
?_test(true == get_boolean("ok")),
?_test(true == get_boolean("Y")),
?_test(true == get_boolean("y")),
?_test(false == get_boolean("False")),
?_test(false == get_boolean("No")),
?_test(false == get_boolean("no"))].

-endif.
19 changes: 19 additions & 0 deletions test/ec_talk_tests.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%%% @copyright 2024 Erlware, LLC.
-module(ec_talk_tests).

-include_lib("eunit/include/eunit.hrl").

general_test_() ->
[?_test(42 == ec_talk:get_integer("42")),
?_test(500_211 == ec_talk:get_integer("500211")),
?_test(1_234_567_890 == ec_talk:get_integer("1234567890")),
?_test(12_345_678_901_234_567_890 == ec_talk:get_integer("12345678901234567890")),
?_test(true == ec_talk:get_boolean("true")),
?_test(false == ec_talk:get_boolean("false")),
?_test(true == ec_talk:get_boolean("Ok")),
?_test(true == ec_talk:get_boolean("ok")),
?_test(true == ec_talk:get_boolean("Y")),
?_test(true == ec_talk:get_boolean("y")),
?_test(false == ec_talk:get_boolean("False")),
?_test(false == ec_talk:get_boolean("No")),
?_test(false == ec_talk:get_boolean("no"))].
Loading