Skip to content

Commit

Permalink
Merge pull request #12 from soldierHuang/master
Browse files Browse the repository at this point in the history
fibonacci Benitor
  • Loading branch information
yuehhua authored Apr 19, 2020
2 parents 76f2fe8 + c2182e7 commit e46813e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Fibonacci/src/Fibonacci.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module Fibonacci

src = []
export
Benitor

src = [
"benitor",
]

for s = src
include("$(s).jl")
Expand Down
10 changes: 10 additions & 0 deletions Fibonacci/src/benitor.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Benitor

function fibonacci(n::Int)
if n <= 1
return n
end
return fibonacci(n-1) + fibonacci(n-2)
end

end # module
4 changes: 4 additions & 0 deletions Fibonacci/test/benitor.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@test Benitor.fibonacci(0) == 0
@test Benitor.fibonacci(1) == 1
@test Benitor.fibonacci(2) == 1
@test Benitor.fibonacci(4) == 3
5 changes: 4 additions & 1 deletion Fibonacci/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using Fibonacci
using Test

tests = []
tests = [
"benitor",
]


@testset "Fibonacci.jl" begin
for t in tests
Expand Down

0 comments on commit e46813e

Please sign in to comment.