Sha256: c268d240df0c605e3577ebedf443544004fe990694984db1aa382276a85c91a6

Contents?: true

Size: 1.71 KB

Versions: 173

Compression:

Stored size: 1.71 KB

Contents

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

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

defmodule SaddlePointsTest do
  use ExUnit.Case

  # @tag :pending
  test "extract rows" do
    rows = SaddlePoints.rows("1 2\n10 20")
    assert rows == [[1, 2], [10, 20]]
  end

  @tag :pending
  test "extract a row" do
    rows = SaddlePoints.rows("9 7\n8 6")
    assert Enum.at(rows, 0) == [9, 7]
  end

  @tag :pending
  test "extract other row" do
    rows = SaddlePoints.rows("9 8 7\n19 18 17")
    assert Enum.at(rows, 1) == [19, 18, 17]
  end

  @tag :pending
  test "extract other row again" do
    rows = SaddlePoints.rows("1 4 9\n16 25 36")
    assert Enum.at(rows, 1) == [16, 25, 36]
  end

  @tag :pending
  test "extract a column" do
    columns = SaddlePoints.columns("1 2 3\n4 5 6\n7 8 9\n8 7 6")
    assert Enum.at(columns, 0) == [1, 4, 7, 8]
  end

  @tag :pending
  test "extract another column" do
    columns = SaddlePoints.columns("89 1903 3\n18 3 1\n9 4 800")
    assert Enum.at(columns, 1) == [1903, 3, 4]
  end

  @tag :pending
  test "no saddle point" do
    saddle_points = SaddlePoints.saddle_points("2 1\n1 2")
    assert saddle_points == []
  end

  @tag :pending
  test "a saddle point" do
    saddle_points = SaddlePoints.saddle_points("1 2\n3 4")
    assert saddle_points == [{0, 1}]
  end

  @tag :pending
  test "another saddle point" do
    saddle_points = SaddlePoints.saddle_points("18 3 39 19 91\n38 10 8 77 320\n3 4 8 6 7")
    assert saddle_points == [{2, 2}]
  end

  @tag :pending
  test "multiple saddle points" do
    saddle_points = SaddlePoints.saddle_points("4 5 4\n3 5 5\n1 5 4")
    assert saddle_points == [{0, 1}, {1, 1}, {2, 1}]
  end
end

Version data entries

173 entries across 173 versions & 1 rubygems

Version Path
trackler-2.2.1.29 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.28 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.27 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.26 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.25 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.24 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.23 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.22 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.21 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.20 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.19 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.18 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.17 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.16 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.15 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.14 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.13 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.12 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.11 tracks/elixir/exercises/saddle-points/saddle_points_test.exs
trackler-2.2.1.10 tracks/elixir/exercises/saddle-points/saddle_points_test.exs