From 557cf2eda79c9784f75fdd8ea53573deb13d70e5 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Sun, 16 Feb 2014 18:49:33 +0700 Subject: [PATCH] Add simple-check based roundtrip test --- test/taoensso/nippy/tests/main.clj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/taoensso/nippy/tests/main.clj b/test/taoensso/nippy/tests/main.clj index a033981..01f823a 100644 --- a/test/taoensso/nippy/tests/main.clj +++ b/test/taoensso/nippy/tests/main.clj @@ -27,6 +27,11 @@ :password [:salted "p"]})) test-data)) +(expect ; Try roundtrip anything that simple-check can dream up + (:result (sc/quick-check 80 ; Time is n-non-linear + (sc-prop/for-all [val sc-gen/any] + (= val (nippy/thaw (nippy/freeze val))))))) + (expect AssertionError (thaw (freeze test-data {:password "malformed"}))) (expect Exception (thaw (freeze test-data {:password [:salted "p"]}))) (expect Exception (thaw (freeze test-data {:password [:salted "p"]}) @@ -105,7 +110,7 @@ (let [{:keys [result bin->val val->bin]} (qc-prop-bijection 10)] [result (vals bin->val)])) -;; (expect #(:result %) (qc-prop-bijection 120)) ; Time seems to be n-non-linear +;; (expect #(:result %) (qc-prop-bijection 120)) ; Time is n-non-linear (expect #(:result %) (qc-prop-bijection 80)) ;;;; Benchmarks