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.78 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.77 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.76 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.75 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.74 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.73 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.72 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.71 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.70 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.69 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.68 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.67 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.66 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.65 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.64 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.63 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.62 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.61 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.60 tracks/julia/exercises/rotational-cipher/runtests.jl
trackler-2.2.1.59 tracks/julia/exercises/rotational-cipher/runtests.jl