diff src/clojure/test_clojure/transients.clj @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/clojure/test_clojure/transients.clj	Sat Aug 21 06:25:44 2010 -0400
     1.3 @@ -0,0 +1,12 @@
     1.4 +(ns clojure.test-clojure.transients
     1.5 +  (:use clojure.test))
     1.6 +
     1.7 +(deftest popping-off
     1.8 +  (testing "across a node boundary"
     1.9 +    (are [n] 
    1.10 +      (let [v (-> (range n) vec)]
    1.11 +        (= (subvec v 0 (- n 2)) (-> v transient pop! pop! persistent!)))
    1.12 +      33 (+ 32 (inc (* 32 32))) (+ 32 (inc (* 32 32 32)))))
    1.13 +  (testing "off the end"
    1.14 +    (is (thrown-with-msg? IllegalStateException #"Can't pop empty vector"
    1.15 +          (-> [] transient pop!)))))