Sha256: 294c381edd8b28f48d0ec0d93c992b656f1c02f1508253eb24635ac69fb6cdfb

Contents?: true

Size: 1.84 KB

Versions: 206

Compression:

Stored size: 1.84 KB

Contents

using Base.Test

include("rotational-cipher.jl")

@testset "rotate function" begin
    @testset "rotate by n" begin
        @testset "no wrap" begin
            @test rotate(1, "a") == "b"
            @test rotate(1, 'a') == 'b'
            @test rotate(13, "m") == "z"
            @test rotate(13, 'm') == 'z'
        end
        @testset "wrap around" begin
            @test rotate(13, "n") == "a"
            @test rotate(13, 'n') == 'a'
        end
    end

    @testset "full rotation" begin
        @test rotate(26, "a") == "a"
        @test rotate(26, 'a') == 'a'
        @test rotate(0, "a") == "a"
        @test rotate(0, 'a') == 'a'
    end

    @testset "full strings" begin
        @test rotate(5, "OMG") == "TRL"
        @test rotate(5, "O M G") == "T R L"
        @test rotate(4, "Testing 1 2 3 testing") == "Xiwxmrk 1 2 3 xiwxmrk"
        @test rotate(21, "Let's eat, Grandma!") == "Gzo'n zvo, Bmviyhv!"
        @test rotate(13, "The quick brown fox jumps over the lazy dog.") == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
    end
end

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Additional exercises                                                        #
# Change @test_skip to @test for the optional bonus exercises from HINTS.md   #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Bonus A
@testset "Bonus A: string literal R13" begin
    @test_skip R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
end

# Bonus B
@testset "Bonus B: string literals" begin
    @test_skip R5"OMG" == "TRL"
    @test_skip R4"Testing 1 2 3 testing" == "Xiwxmrk 1 2 3 xiwxmrk"
    @test_skip R21"Let's eat, Grandma!" == "Gzo'n zvo, Bmviyhv!"
    @test_skip R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
end

Version data entries

206 entries across 206 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.179 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.178 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.177 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.176 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.175 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.174 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.173 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.172 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.171 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.170 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.169 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.167 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.166 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.165 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.164 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.163 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.162 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.161 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.160 tracks/julia/exercises/rotational-cipher/runtests.jl