Sha256: 5fc7665627f6a7fe640f0d3bd4aa18766af79fec70d4cfef3dc53b7a2441e3cb

Contents?: true

Size: 1.72 KB

Versions: 69

Compression:

Stored size: 1.72 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

69 entries across 69 versions & 1 rubygems

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