Skip to content

Instantly share code, notes, and snippets.

@slipset
Last active October 20, 2018 10:29
Show Gist options
  • Save slipset/645b1a785a0d6e23097e03b837b6a18b to your computer and use it in GitHub Desktop.
Save slipset/645b1a785a0d6e23097e03b837b6a18b to your computer and use it in GitHub Desktop.
checking if fns are valid
{:paths ["resources" "src"]
:deps {org.clojure/clojure {:mvn/version "RELEASE"}
org.clojure/test.check {:mvn/version "RELEASE"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "RELEASE"}}}
:runner
{:extra-deps {com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner"
:sha "76568540e7f40268ad2b646110f237a60295fa3c"}}
:main-opts ["-m" "cognitect.test-runner"
"-d" "test"]}}}
(ns speculative
(:require [clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as stest]))
;; This doesn't work all that well because it seems like
;; we use generative testing to verify that a higher order fn
;; satisfies the spec
(s/def ::reducing-fn (s/fspec :args (s/cat :accumulator any? :elem any?)))
(s/valid? ::reducing-fn (fn [x y]) ;; takes forever and ends with a out of heap memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment