Created
March 13, 2016 16:10
-
-
Save timgluz/b89ad29316d4b2633de1 to your computer and use it in GitHub Desktop.
Stress-data for spyglass NippyTranscoder
This file contains 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
(def nippy-transcoder (make-transcoder :nippy)) | |
(deftest test-nippy-transcoder | |
(testing "roundtrip returns correct value" | |
(are [k v] | |
(do (c/set tc k 1 v nippy-transcoder) | |
(is (= v (c/get tc k nippy-transcoder)))) | |
"text" "abc" | |
"nil" nil | |
"boolean" true | |
"char-utf8" \ಬ | |
;"bytes" (byte-array [(byte 1) (byte 2) (byte 3)]) | |
"ascii" "abcdefghi" | |
"utf-8" "ಬಾ ಇಲ್ಲಿ ಸಂಭ" | |
"long-string" (apply str (range 1000)) | |
"keyword" :yep-its-valid | |
"ns-keyword" ::nskeyword | |
"queue" (-> (PersistentQueue/EMPTY) (conj :a :b :c :d :e :f :g)) | |
"queue-empty" (PersistentQueue/EMPTY) | |
"sorted-set" (sorted-set 1 2 3 4 5) | |
"sorted-map" (sorted-map :b 2 :a 1 :d 4 :c 3) | |
"list" (list 1 2 3 4 5 (list 6 7 8 (list 9 10))) | |
"list-quoted" '(1 2 3 4 5 (6 7 8 (9 10))) | |
"list-empty" (list) | |
"vector" [1 2 3 4 5 [6 7 8 [9 10]]] | |
"vector-empty" [] | |
"map" {:a 1 :b 2 :c 3 :d {:e 4 :f {:g 5 :h 6 :i 7}}} | |
"map-empty" {} | |
"set" #{1 2 3 4 5 #{6 7 8 #{9 10}}} | |
"set-empty" #{} | |
"meta" (with-meta {:a :A} {:metakey :metaval}) | |
"lazy-seq" test-lazy-seq | |
"byte" (byte 16) | |
"short" (short 42) | |
"integer" (int 42) | |
"long" (long 42) | |
"bigint" (bigint 31415926535897932384626433832795) | |
"float" (float 3.14) | |
"double" (double 3.14) | |
"bigdec" (bigdec 3.1415926535897932384626433832795) | |
"ratio" 22/7 | |
"uuid" test-uuid | |
"date" test-date | |
"record" (->StressRecord "Hello, world!") | |
;"throwable" (Throwable. "Yolo") | |
;"exception" (try (/ 1 0) (catch Exception e e)) | |
;"ex-info" (ex-info "ExInfo" {:data "data"}) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment