clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
dharrigan 2021-04-23T05:17:34.258400Z

Good Morning!

RAMart 2021-04-23T05:27:08.258800Z

β˜€οΈ 😎 β˜•

djm 2021-04-23T05:47:57.259Z

πŸ‘‹

2021-04-23T07:11:15.259400Z

morning

simongray 2021-04-23T07:16:11.259600Z

morning

javahippie 2021-04-23T07:31:44.259800Z

Moin!

thomas 2021-04-23T07:58:45.260Z

morning

mccraigmccraig 2021-04-23T08:01:51.260200Z

mΓ₯ning

jasonbell 2021-04-23T08:37:55.260400Z

morning

slipset 2021-04-23T08:59:11.260800Z

This mornings little fun:

(s/def ::json-number
  (s/with-gen
    number?
    #(sgen/one-of [(sgen/large-integer) (sgen/double* {:infinite? false :NaN? false})])))

(s/def ::json-scalar (s/or :boolean boolean?
                           :number ::json-number
                           :string string?
                           :nil nil?))

(s/def ::json-value (s/or :object ::json-object
                          :array ::json-array
                          :scalar ::json-scalar))

(s/def ::json-array (s/coll-of ::json-value))
(s/def ::json-object (s/map-of string? ::json-value
                               :gen-max 10))

(s/fdef json/write-str
  :args (s/cat :json ::json-value)
  :ret string?
  :fn #(= (->> % :args :json (s/unform ::json-value))
          (json/read-str (-> % :ret))))

(deftest roundtrip
  (let [results (stest/check `json/write-str)]
    (is (every? nil? (mapv :failure results)))))

πŸ‘ 1
slipset 2021-04-23T08:59:31.261100Z

functions with inverses are really nice for generative testing.