erlang-labs/test/mobius_test.erl

31 lines
881 B
Erlang
Raw Normal View History

2023-02-13 12:14:07 +03:00
%%%-------------------------------------------------------------------
%%% @author ivan-igorevich
%%% @copyright (C) 2023, self
%%% @doc
%%%
%%% @end
%%% Created : 13. Feb 2023 9:03 AM
%%%-------------------------------------------------------------------
-module(mobius_test).
-include_lib("eunit/include/eunit.hrl").
mobius_test_() -> [
2023-02-13 13:27:26 +03:00
{"Test is_prime", fun test_is_prime/0},
{"Test prime_factors", fun test_find_square_multiples/0}
2023-02-13 12:14:07 +03:00
].
test_is_prime() ->
?assertNot(mobius:is_prime(1)),
?assert(mobius:is_prime(2)),
?assert(mobius:is_prime(3)),
?assertNot(mobius:is_prime(58)),
?assert(mobius:is_prime(59)),
?assertNot(mobius:is_prime(60)),
?assertNot(mobius:is_prime(112)),
?assert(mobius:is_prime(113)).
2023-02-13 13:27:26 +03:00
test_find_square_multiples() ->
?assertEqual(fail, mobius:find_square_multiples(3, 20)),
?assertEqual(48, mobius:find_square_multiples(3, 50)).