31 lines
881 B
Erlang
31 lines
881 B
Erlang
%%%-------------------------------------------------------------------
|
|
%%% @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_() -> [
|
|
{"Test is_prime", fun test_is_prime/0},
|
|
{"Test prime_factors", fun test_find_square_multiples/0}
|
|
].
|
|
|
|
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)).
|
|
|
|
|
|
test_find_square_multiples() ->
|
|
?assertEqual(fail, mobius:find_square_multiples(3, 20)),
|
|
?assertEqual(48, mobius:find_square_multiples(3, 50)).
|