1
exercism fetch elixir crypto-square

crypto_square_test.exs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
  Code.load_file("crypto_square.exs", __DIR__)
end

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

defmodule CryptoSquareTest do
  use ExUnit.Case

  # @tag :pending
  test "empty string" do
    assert CryptoSquare.encode("") == ""
  end

  @tag :pending
  test "perfect square" do
    assert CryptoSquare.encode("abcd") == "ac bd"
  end

  @tag :pending
  test "uppercase string" do
    assert CryptoSquare.encode("ABCD") == "ac bd"
  end

  @tag :pending
  test "small imperfect square" do
    assert CryptoSquare.encode("This is easy") == "tis hsy ie sa"
  end

  @tag :pending
  test "punctuation and numbers" do
    assert CryptoSquare.encode("1, 2, 3, Go! Go, for God's sake!") == "1gga 2ook 3fde gos ors"
  end

  @tag :pending
  test "long string" do
    msg = "If man was meant to stay on the ground, god would have given us roots."
    cipher = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau"
    assert CryptoSquare.encode(msg) == cipher
  end
end