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.139 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.138 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.137 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.136 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.135 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.134 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.133 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.132 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.131 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.130 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.129 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.128 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.127 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.126 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.125 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.124 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.123 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.122 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.121 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.120 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs