              [generators :as gen]
              [properties :as prop]]
             [superstring.core :as str]))
+
+(defmacro defexamples [name & examples]
+  `(deftest ~name
+     (are [actual expected] (= actual expected)
+       ~@examples)))
 
 (defspec appending-separator-and-chomping-does-not-alter-length 100
   (prop/for-all [s gen/string

  (prop/for-all [s string-ascii]
    (is (not (str/mixed-case? (str/upper-case s))))))

(deftest mixed-case?-test
  (are [expected actual] (= expected actual)
    "FooBar" (str/mixed-case? "FooBar")
    nil (str/mixed-case? "foo")))

(def whitespace
  (gen/fmap #(apply str %)

                                      (gen/choose 3 (max 4 (- (.length s) 3)) ))))]
    (= (.length (str/truncate s len)) (min (.length s) len))))

(defexamples truncate
  (str/truncate "" 3) ""
  (str/truncate "123456" 3) "..."
  (str/truncate "123456" 6) "123..."
  (str/truncate "1" 3) "1"
  (str/truncate "12" 3) "12"
  (str/truncate "123" 3) "123")

(defexamples common-prefix
  (str/common-prefix "321" "123") ""
  (str/common-prefix "Åffø123456" "Åfføo8yuidfg") "Åffø"
  (str/common-prefix "123456" "123o8yuidfg") "123"
  (str/common-prefix "Åberg" "åberg") ""
  (str/common-prefix "åberg" "Åberg" :ignore-case) "Åberg"
  (str/common-prefix "Åberg" "åberg" :ignore-case) "åberg")

(defspec common-prefix-finds-common-prefixes 100
  (prop/for-all [prefix (gen/not-empty gen/string)
