Sha256: 2f47234e930f79fe5ab956b17aa6c5f46210ce73f3a51eb5a24227eb6b143e64

Contents?: true

Size: 1.39 KB

Versions: 69

Compression:

Stored size: 1.39 KB

Contents

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

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

defmodule MatrixTest do
  use ExUnit.Case

  @input "1 2 3\n4 5 6\n7 8 9"

  # @tag :pending
  test "reading from and writing to string" do
    matrix = Matrix.from_string(@input)
    assert Matrix.to_string(matrix) == @input
  end

  @tag :pending
  test "rows should return nested lists regardless of internal structure" do
    matrix = Matrix.from_string(@input)

    assert Matrix.rows(matrix) == [
             [1, 2, 3],
             [4, 5, 6],
             [7, 8, 9]
           ]
  end

  @tag :pending
  test "row should return list at index" do
    matrix = Matrix.from_string(@input)

    assert Matrix.row(matrix, 0) == [1, 2, 3]
    assert Matrix.row(matrix, 1) == [4, 5, 6]
    assert Matrix.row(matrix, 2) == [7, 8, 9]
  end

  @tag :pending
  test "columns should return nested lists regardless of internal structure" do
    matrix = Matrix.from_string(@input)

    assert Matrix.columns(matrix) == [
             [1, 4, 7],
             [2, 5, 8],
             [3, 6, 9]
           ]
  end

  @tag :pending
  test "column should return list at index" do
    matrix = Matrix.from_string(@input)

    assert Matrix.column(matrix, 0) == [1, 4, 7]
    assert Matrix.column(matrix, 1) == [2, 5, 8]
    assert Matrix.column(matrix, 2) == [3, 6, 9]
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

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