Compare commits

..

No commits in common. "90f68a083f439e39e503370617e5df4320f8b529" and "862b327b81a8f42975ea56f27527d0a072cd4abf" have entirely different histories.

3 changed files with 0 additions and 70 deletions

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="ERLANG_MODULE" version="4">
<component name="FacetManager">
<facet type="erlang" name="Erlang">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
</content>
<orderEntry type="jdk" jdkName="Erlang 25" jdkType="Erlang SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,12 +0,0 @@
-module(fib).
-export([fib_p/1]).
% Сопоставление с образцом
fib_p(0) -> 0;
fib_p(1) -> 1;
fib_p(N) -> fib_p(N - 1) + fib_p(N - 2).
% Сторожевая последовательность
fib_g(N) when N < 1 -> 0;
fib_g(N) when N < 2 -> 1;
fib_g(N) -> fib_g(N-1) + fib_g(N-2).

View File

@ -1,41 +0,0 @@
%%%-------------------------------------------------------------------
%%% @author ivan
%%% @copyright (C) 2023, self
%%% @doc
%%%
%%% @end
%%% Created : 09. Feb 2023 23:52
%%%-------------------------------------------------------------------
-module(fib_test).
-include_lib("eunit/include/eunit.hrl").
fib_test_() -> [
{"Test fib_p", fun test_fib_p/0 },
{"Test fib_g", fun test_fib_g/0 }
].
test_fib_p() ->
?assertEqual(0, fib:fib_p(0)),
?assertEqual(1, fib:fib_p(1)),
?assertEqual(1, fib:fib_p(2)),
?assertEqual(2, fib:fib_p(3)),
?assertEqual(3, fib:fib_p(4)),
?assertEqual(5, fib:fib_p(5)),
?assertEqual(8, fib:fib_p(6)),
?assertEqual(13, fib:fib_p(7)),
?assertEqual(21, fib:fib_p(8)),
?assertEqual(34, fib:fib_p(9)),
?assertEqual(55, fib:fib_p(10)).
test_fib_g() ->
?assertEqual(0, fib:fib_g(0)),
?assertEqual(1, fib:fib_g(1)),
?assertEqual(1, fib:fib_g(2)),
?assertEqual(2, fib:fib_g(3)),
?assertEqual(3, fib:fib_g(4)),
?assertEqual(5, fib:fib_g(5)),
?assertEqual(8, fib:fib_g(6)),
?assertEqual(13, fib:fib_g(7)),
?assertEqual(21, fib:fib_g(8)),
?assertEqual(34, fib:fib_g(9)),
?assertEqual(55, fib:fib_g(10)).