aboutsummaryrefslogtreecommitdiff
path: root/challenge-261/barroff/julia/ch-2.jl
blob: 15caccf46dcc6dfb7589abb8570101645ed8b148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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