Sha256: 0019df2499494436d6548e4758c832838c4eaa6015007e65a8784033e9464cf0

Contents?: true

Size: 1.9 KB

Versions: 119

Compression:

Stored size: 1.9 KB

Contents

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

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

defmodule DominoesTest do
  use ExUnit.Case

  test "empty input = empty output" do
    assert Dominoes.chain?([]) == true
  end

  @tag :pending
  test "singleton input = singleton output" do
    assert Dominoes.chain?([{1, 1}]) == true
  end

  @tag :pending
  test "singleton that can't be chained" do
    assert Dominoes.chain?([{1, 2}]) == false
  end

  @tag :pending
  test "three elements" do
    assert Dominoes.chain?([{1, 2}, {3, 1}, {2, 3}]) == true
  end

  @tag :pending
  test "can reverse dominoes" do
    assert Dominoes.chain?([{1, 2}, {1, 3}, {2, 3}]) == true
  end

  @tag :pending
  test "can't be chained" do
    assert Dominoes.chain?([{1, 2}, {4, 1}, {2, 3}]) == false
  end

  @tag :pending
  test "disconnected - double loop" do
    assert Dominoes.chain?([{1, 2}, {2, 1}, {3, 4}, {4, 3}]) == false
  end

  @tag :pending
  test "disconnected - single isolated" do
    assert Dominoes.chain?([{1, 2}, {2, 3}, {3, 1}, {4, 4}]) == false
  end

  @tag :pending
  test "need backtrack" do
    assert Dominoes.chain?([{1, 2}, {2, 3}, {3, 1}, {2, 4}, {2, 4}]) == true # a variation in which we have to turn but no duplicates
  end

  @tag :pending
  test "separate loops" do
    assert Dominoes.chain?([{1, 2}, {2, 3}, {3, 1}, {1, 1}, {2, 2}, {3, 3}]) == true
  end

  @tag :pending
  test "nine elements" do
    assert Dominoes.chain?([{1, 2}, {5, 3}, {3, 1}, {1, 2}, {2, 4}, {1, 6}, {2, 3}, {3, 4}, {5, 6}]) == true
 end


  @tag :pending
  test "disconnected - simple" do
    refute Dominoes.chain?([{1, 1}, {2, 2}])
  end

  @tag :pending
  test "first and last not matching" do
    assert Dominoes.chain?([{1, 2}, {2, 3}, {3, 4}]) == false
  end

  @tag :pending
  test "wrong starting order" do
    assert Dominoes.chain?([{2, 1}, {2, 3}, {3, 1}]) == true
  end
end

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
trackler-2.2.1.109 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.108 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.107 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.106 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.105 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.104 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.103 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.102 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.101 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.100 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.99 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.98 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.97 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.96 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.95 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.94 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.93 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.92 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.91 tracks/elixir/exercises/dominoes/dominoes_test.exs
trackler-2.2.1.90 tracks/elixir/exercises/dominoes/dominoes_test.exs