Permalink
Browse files

Add test for our new use of OrderedMap

  • Loading branch information...
1 parent 79f5053 commit 4cd8e837725a422cc1cba47e4f7950d8a4e25230 @amalloy amalloy committed Apr 24, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 test/protobuf/core_test.clj
@@ -1,5 +1,6 @@
(ns protobuf.core-test
- (:use protobuf.core clojure.test)
+ (:use protobuf.core clojure.test
+ ordered-map.core)
(:import (java.io PipedInputStream PipedOutputStream)))
(def Foo (protodef protobuf.test.Core$Foo))
@@ -51,6 +52,16 @@
(is (= [1.2 3.4] (:doubles p)))
(is (= [(float 0.01) (float 0.02)] (:floats p))))))
+(deftest test-ordered-append
+ (let [inputs (apply ordered-map (for [x (range 26)
+ entry [(str x) (str (char (+ (int \a) x)))]]
+ entry))]
+ (= (seq inputs)
+ (seq (reduce (fn [m [k v]]
+ (append m {:attr_map {k v}}))
+ (protobuf Foo)
+ inputs)))))
+
(deftest test-assoc
(let [p (protobuf Foo :id 5 :tags ["little" "yellow"] :foo-by-id {1 {:label "one"} 2 {:label "two"}})]
(let [p (assoc p :label "baz" :tags ["nuprin"])]

0 comments on commit 4cd8e83

Please sign in to comment.