Sha256: 33f1ff57f1d17e9c54731f5b4fb98aca19fe279e9fd55d44997c41a263142b65

Contents?: true

Size: 1.17 KB

Versions: 91

Compression:

Stored size: 1.17 KB

Contents

(ns isbn-verifier-test
  (:require [clojure.test :refer [deftest is]]
            [isbn-verifier :refer [isbn?]]))

(deftest valid-isbn-number
  (is (= true (isbn? "3-598-21508-8"))))

(deftest invalid-isbn-check-digit
  (is (= false (isbn? "3-598-21508-9"))))

(deftest valid-isbn-number-with-a-check-digit-of-10
  (is (= true (isbn? "3-598-21507-X"))))

(deftest check-digit-is-a-character-other-than-X
  (is (= false (isbn? "3-598-21507-A"))))

(deftest invalid-character-in-isbn
  (is (= false (isbn? "3-598-2K507-0"))))

(deftest X-is-only-valid-as-a-check-digit
  (is (= false (isbn? "3-598-2X507-9"))))

(deftest valid-isbn-without-separating-dashes
  (is (= true (isbn? "3598215088"))))

(deftest isbn-without-separating-dashes-and-X-as-check-digit
  (is (= true (isbn? "359821507X"))))

(deftest isbn-without-check-digit-and-dashes
  (is (= false (isbn? "359821507"))))

(deftest too-long-isbn-and-no-dashes
  (is (= false (isbn? "3598215078X"))))

(deftest isbn-without-check-digit
  (is (= false (isbn? "3-598-21507"))))

(deftest too-long-isbn
  (is (= false (isbn? "3-598-21507-XX"))))

(deftest check-digit-of-X-should-not-be-used-for-0
  (is (= false (isbn? "3-598-21515-X"))))

Version data entries

91 entries across 91 versions & 1 rubygems

Version Path
trackler-2.2.1.166 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.165 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.164 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.163 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.162 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.161 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.160 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.159 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.158 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.157 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.156 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.155 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.154 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.153 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.152 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.151 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.150 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.149 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.148 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
trackler-2.2.1.147 tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj