Sha256: aa2d39cebffd844231b77e15d99ffb7d3a5d41a254e4d85ec4f4e7c0414c361f

Contents?: true

Size: 656 Bytes

Versions: 135

Compression:

Stored size: 656 Bytes

Contents

using Base.Test

include("grains.jl")

@testset "On squares" begin
    @testset "On square $s" for s = UInt64(1):64
        @test on_square(s) == 2^(s-1)
        @test total_after(s) == 2^s - 1
    end
end

@testset "Invalid values" begin
    @testset "Zero" begin
        @test_throws DomainError on_square(0)
        @test_throws DomainError total_after(0)
    end
    
    @testset "Negative" begin
        @test_throws DomainError on_square(-1)
        @test_throws DomainError total_after(-1)
    end
    
    @testset "Greater than 64" begin
        @test_throws DomainError on_square(65)
        @test_throws DomainError total_after(65)
    end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.77 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.76 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.75 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.74 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.73 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.72 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.71 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.70 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.69 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.68 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.67 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.66 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.65 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.64 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.63 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.62 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.61 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.60 tracks/julia/exercises/grains/runtests.jl
trackler-2.2.1.59 tracks/julia/exercises/grains/runtests.jl