Tests housekeeping
This commit is contained in:
parent
2f27666d05
commit
53d993e132
1 changed files with 13 additions and 13 deletions
|
|
@ -40,7 +40,7 @@
|
|||
(check-props/for-all [val check-gen/any]
|
||||
(= val (thaw (freeze val)))))))
|
||||
|
||||
;;; These can sometimes crash the JVM
|
||||
;;; Trying to decrypt random (invalid) data can actually crash JVM
|
||||
;; (expect Exception (thaw (freeze test-data {:password "malformed"})))
|
||||
;; (expect Exception (thaw (freeze test-data {:password [:salted "p"]})))
|
||||
;; (expect Exception (thaw (freeze test-data {:password [:salted "p"]})
|
||||
|
|
@ -77,25 +77,26 @@
|
|||
(nippy/extend-thaw :nippy-tests/MyType [s] (->MyType (.readUTF s)))
|
||||
(let [type (->MyType "val")] (= type (thaw (freeze type))))))
|
||||
|
||||
;;;; Stable binary representation of vals ; EXPERIMENTAL
|
||||
;;;; Stable binary representation of vals
|
||||
|
||||
(expect (seq (freeze test-data))
|
||||
(seq (freeze test-data))) ; f(x)=f(y) | x=y
|
||||
|
||||
;;; As above, but try multiple times (catch protocol interface races):
|
||||
;; As above, but try multiple times to catch possible protocol interface races:
|
||||
(expect #(every? true? %)
|
||||
(repeatedly 1000 (fn [] (= (seq (freeze test-data))
|
||||
(seq (freeze test-data))))))
|
||||
|
||||
(expect (seq (-> test-data freeze)) ; f(x)=f(f-1(f(x)))
|
||||
(seq (-> test-data freeze thaw freeze)))
|
||||
|
||||
;;; As above, but with repeated refreeze (catch protocol interface races):
|
||||
(expect (= (seq (freeze test-data))
|
||||
(seq (reduce (fn [frozen _] (freeze (thaw frozen)))
|
||||
(freeze test-data) (range 1000)))))
|
||||
|
||||
;;;
|
||||
;; NB abandoning - no way to do this reliably w/o appropriate contracts from
|
||||
;; (seq <unordered-coll>):
|
||||
;;
|
||||
;; (expect (seq (-> test-data freeze)) ; f(x)=f(f-1(f(x)))
|
||||
;; (seq (-> test-data freeze thaw freeze)))
|
||||
;;
|
||||
;; As above, but with repeated refreeze to catch possible protocol interface races:
|
||||
;; (expect (= (seq (freeze test-data))
|
||||
;; (seq (reduce (fn [frozen _] (freeze (thaw frozen)))
|
||||
;; (freeze test-data) (range 1000)))))
|
||||
|
||||
(defn qc-prop-bijection [& [n]]
|
||||
(let [bin->val (atom {})
|
||||
|
|
@ -125,7 +126,6 @@
|
|||
(let [{:keys [result bin->val val->bin]} (qc-prop-bijection 10)]
|
||||
[result (vals bin->val)]))
|
||||
|
||||
;; (expect #(:result %) (qc-prop-bijection 120)) ; Time is n-non-linear
|
||||
(expect #(:result %) (qc-prop-bijection 80))
|
||||
|
||||
;;;; Thread safety
|
||||
|
|
|
|||
Loading…
Reference in a new issue