Sha256: f85ab117df461f3e1d4c73ed1dcac7c2baa48b1d11884d29d47a11d887069534

Contents?: true

Size: 1.56 KB

Versions: 69

Compression:

Stored size: 1.56 KB

Contents

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

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

defmodule LuhnTest do
  use ExUnit.Case

  test "single digit strings can not be valid" do
    refute Luhn.valid?("1")
  end

  @tag :pending
  test "A single zero is invalid" do
    refute Luhn.valid?("0")
  end

  @tag :pending
  test "a simple valid SIN that remains valid if reversed" do
    assert Luhn.valid?("059")
  end

  @tag :pending
  test "a simple valid SIN that becomes invalid if reversed" do
    assert Luhn.valid?("59")
  end

  @tag :pending
  test "a valid Canadian SIN" do
    assert Luhn.valid?("055 444 285")
  end

  @tag :pending
  test "invalid Canadian SIN" do
    refute Luhn.valid?("055 444 286")
  end

  @tag :pending
  test "invalid credit card" do
    refute Luhn.valid?("8273 1232 7352 0569")
  end

  @tag :pending
  test "valid strings with a non-digit included become invalid" do
    refute Luhn.valid?("055a 444 285")
  end

  @tag :pending
  test "valid strings with punctuation included become invalid" do
    refute Luhn.valid?("055-444-285")
  end

  @tag :pending
  test "valid strings with symbols included become invalid" do
    refute Luhn.valid?("055£ 444$ 285")
  end

  @tag :pending
  test "single zero with space is invalid" do
    refute Luhn.valid?(" 0")
  end

  @tag :pending
  test "more than a single zero is valid" do
    assert Luhn.valid?("0000 0")
  end

  @tag :pending
  test "input digit 9 is correctly converted to output digit 9" do
    assert Luhn.valid?("091")
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

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