diff options
Diffstat (limited to 'challenge-261/barroff/julia/ch-2.jl')
| -rw-r--r-- | challenge-261/barroff/julia/ch-2.jl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-261/barroff/julia/ch-2.jl b/challenge-261/barroff/julia/ch-2.jl new file mode 100644 index 0000000000..15caccf46d --- /dev/null +++ b/challenge-261/barroff/julia/ch-2.jl @@ -0,0 +1,13 @@ +#!/usr/bin/env julia + +using Test: @test, @testset + +function multiply_by_two(start::T, ints::Vector{T})::Int where {T<:Integer} + start in ints ? multiply_by_two(2 * start, ints) : start +end + +@testset "count even digits number" begin + @test multiply_by_two(3, [5, 3, 6, 1, 12]) == 24 + @test multiply_by_two(1, [1, 2, 4, 3]) == 8 + @test multiply_by_two(2, [5, 6, 7]) == 2 +end |
