Show More
Commit Description:
Add property-based testing (and fix a bug).
Commit Description:
Add property-based testing (and fix a bug).
References:
File last commit:
Show/Diff file:
Action:
test/project_checkup/core_property_test.clj
27 lines | 849 B | text/x-clojure | ClojureLexer
(ns project-checkup.core-property-test
(:gen-class)
(:require [clojure.test :refer :all]
[project-checkup.core :refer :all]
[clojure.test.check :as tc]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[clojure.test.check.clojure-test :refer :all]))
;arguably redundant
(defspec get-extension-returns-string
100
(prop/for-all [st (gen/not-empty gen/string-ascii)
ext (gen/not-empty gen/string-alphanumeric) ]
(string? (get-extension (str st \. ext ))) ))
(defspec get-extension-returns-extension
100
(prop/for-all [st (gen/not-empty gen/string-ascii)
ext (gen/not-empty gen/string-alphanumeric) ]
(= (get-extension (str st \. ext ))
(str \. ext)) ))