Created
October 21, 2013 20:45
-
-
Save ecmendenhall/7090683 to your computer and use it in GitHub Desktop.
A macro for Speclj-style simple-check assertions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns my-great-project.core-spec | |
(:require [speclj.core :refer :all] | |
[simple-check.core :as sc] | |
[simple-check.generators :as gen] | |
[simple-check.properties :as prop] | |
[my-great-project.core :refer :all])) | |
(defmacro check-that [desc n property] | |
`(it ~desc | |
(let [check# (sc/quick-check ~n ~property) | |
passed# (:result check#)] | |
(when-not passed# (println check#)) | |
(should passed#)))) | |
(describe "Addition" | |
(check-that "addition is commutative" 100 | |
(prop/for-all [a gen/int | |
b gen/int] | |
(= (+ a b) (+ b a))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment