Sha256: e774d06f88cc042e984417aed93e410be4aff873f60a857a70b2ed8b10a6dd81

Contents?: true

Size: 1.9 KB

Versions: 69

Compression:

Stored size: 1.9 KB

Contents

if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("rotational_cipher.exs", __DIR__)
end

ExUnit.start()
ExUnit.configure(exclude: :pending, trace: true)

defmodule RotationalCipherTest do
  use ExUnit.Case

  # @tag :pending
  test "rotate a by 1" do
    plaintext = "a"
    shift = 1
    assert RotationalCipher.rotate(plaintext, shift) == "b"
  end

  @tag :pending
  test "rotate a by 26, same output as input" do
    plaintext = "a"
    shift = 26
    assert RotationalCipher.rotate(plaintext, shift) == "a"
  end

  @tag :pending
  test "rotate a by 0, same output as input" do
    plaintext = "a"
    shift = 0
    assert RotationalCipher.rotate(plaintext, shift) == "a"
  end

  @tag :pending
  test "rotate m by 13" do
    plaintext = "m"
    shift = 13
    assert RotationalCipher.rotate(plaintext, shift) == "z"
  end

  @tag :pending
  test "rotate n by 13 with wrap around alphabet" do
    plaintext = "n"
    shift = 13
    assert RotationalCipher.rotate(plaintext, shift) == "a"
  end

  @tag :pending
  test "rotate capital letters" do
    plaintext = "OMG"
    shift = 5
    assert RotationalCipher.rotate(plaintext, shift) == "TRL"
  end

  @tag :pending
  test "rotate spaces" do
    plaintext = "O M G"
    shift = 5
    assert RotationalCipher.rotate(plaintext, shift) == "T R L"
  end

  @tag :pending
  test "rotate numbers" do
    plaintext = "Testing 1 2 3 testing"
    shift = 4
    assert RotationalCipher.rotate(plaintext, shift) == "Xiwxmrk 1 2 3 xiwxmrk"
  end

  @tag :pending
  test "rotate punctuation" do
    plaintext = "Let's eat, Grandma!"
    shift = 21
    assert RotationalCipher.rotate(plaintext, shift) == "Gzo'n zvo, Bmviyhv!"
  end

  @tag :pending
  test "rotate all letters" do
    plaintext = "The quick brown fox jumps over the lazy dog."
    shift = 13

    assert RotationalCipher.rotate(plaintext, shift) ==
             "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

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