Created
August 8, 2017 17:05
-
-
Save agnellvj/6733411c41224b0e372b85195a5a76be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code.load_file("Spiralizer.exs", __DIR__) | |
ExUnit.start | |
ExUnit.configure exclude: :pending, trace: true | |
defmodule SpiralizerTest do | |
use ExUnit.Case | |
test "empty list" do | |
data = [] | |
assert String.equivalent?(Spiralizer.runner(data), "") | |
end | |
test "3x2" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F"], 3) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c f e d") | |
end | |
test "3x3" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F", "G", "H", "I"], 3) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c f i h g d e") | |
end | |
test "3x4" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"], 3) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c f i l k j g d e h") | |
end | |
test "4x2" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F", "G", "H"], 4) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c d h g f e") | |
end | |
test "4x3" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"], 4) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c d h l k j i e f g") | |
end | |
test "4x4" do | |
data = Enum.chunk_every(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"], 4) | |
assert String.equivalent?(Spiralizer.runner(data), "a b c d h l p o n m i e f g k j") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment