File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 7373 (size* [_ data]
7474 (reduce (fn [acc [field data]]
7575 (let [type (field dict)]
76- (if (satisfies? ISpecSize type)
77- (+ acc (size type))
78- (+ acc (size* type data )))))
76+ (if (satisfies? ISpecDynamicSize type)
77+ (+ acc (size* type data ))
78+ (+ acc (size type)))))
7979 0
8080 (into [] data)))
8181
Original file line number Diff line number Diff line change 466466 (t/is (= readed 24 ))
467467 (t/is (= data [1 2 3 4 5 ])))))
468468
469+ (t/deftest spec-associative-nested-dynamic
470+ (let [spec (buf/spec :outer (buf/spec :inner (buf/vector* buf/int32)))
471+ buffer (buf/into (buf/spec :outer (buf/spec :inner (buf/vector* buf/int32))) {:outer {:inner [1 ]}})
472+ written (impl/get-capacity buffer)]
473+ (t/is (= written 8 ))
474+
475+ (let [[readed data] (buf/read* buffer spec)]
476+ (t/is (= readed 8 )
477+ (t/is (= data {:outer {:inner [1 ]}}))))))
478+
469479#?(:cljs
470480 (do
471481 (enable-console-print! )
You can’t perform that action at this time.
0 commit comments