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.98 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.97 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.96 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.95 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.94 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.93 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.92 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.91 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.90 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.89 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.88 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.87 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.86 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.85 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.84 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.83 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.82 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.81 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.80 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.79 tracks/julia/exercises/rotational-cipher/runtests.jl