Sha256: ac045b74eb4f755575a240cba94137b451af18a5e31c77076c8676b80bfa33b0

Contents?: true

Size: 1.65 KB

Versions: 52

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

52 entries across 52 versions & 1 rubygems

Version Path
trackler-2.2.1.109 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.108 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.107 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.106 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.105 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.104 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.103 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.102 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.101 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.100 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.99 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.98 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.97 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.96 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.95 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.94 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.93 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.92 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.91 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs
trackler-2.2.1.90 tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs