Sha256: 04817fd497f1e8e1bd3f0cf049baa8eee2e53091f32ebf9f2d7d8e74d34e5508

Contents?: true

Size: 1.65 KB

Versions: 69

Compression:

Stored size: 1.65 KB

Contents

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

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

defmodule ISBNVerifierTest do
  use ExUnit.Case

  # @tag :pending
  test "valid isbn number" do
    assert ISBNVerifier.isbn?("3-598-21508-8")
  end

  @tag :pending
  test "invalid isbn check digit" do
    refute ISBNVerifier.isbn?("3-598-21508-9")
  end

  @tag :pending
  test "valid isbn number with a check digit of 10" do
    assert ISBNVerifier.isbn?("3-598-21507-X")
  end

  @tag :pending
  test "check digit is a character other than X" do
    refute ISBNVerifier.isbn?("3-598-21507-A")
  end

  @tag :pending
  test "invalid character in isbn" do
    refute ISBNVerifier.isbn?("3-598-2K507-0")
  end

  @tag :pending
  test "X is only valid as a check digit" do
    refute ISBNVerifier.isbn?("3-598-2X507-0")
  end

  @tag :pending
  test "valid isbn without separating dashes" do
    assert ISBNVerifier.isbn?("3598215088")
  end

  @tag :pending
  test "isbn without separating dashes and X as check digit" do
    assert ISBNVerifier.isbn?("359821507X")
  end

  @tag :pending
  test "isbn without check digit and dashes" do
    refute ISBNVerifier.isbn?("359821507")
  end

  @tag :pending
  test "too long isbn and no dashes" do
    refute ISBNVerifier.isbn?("3598215078X")
  end

  @tag :pending
  test "isbn without check digit" do
    refute ISBNVerifier.isbn?("3-598-21507")
  end

  @tag :pending
  test "too long isbn" do
    refute ISBNVerifier.isbn?("3-598-21507-XA")
  end

  @tag :pending
  test "check digit of X should not be used for 0" do
    refute ISBNVerifier.isbn?("3-598-21515-X")
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

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