File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 262262 (refine-ext
263263 (->Ext (.readByte data-input) (read-bytes n data-input))))
264264
265- (defn- unpack-n [n ^java.io.DataInput data-input]
266- (doall (for [_ (range n)] (unpack-stream data-input))))
265+ (defn- unpack-n [n ^java.io.DataInput data-input opts ]
266+ (doall (for [_ (range n)] (unpack-stream data-input opts ))))
267267
268- (defn- unpack-map [n ^java.io.DataInput data-input]
269- (apply hash-map (unpack-n (* 2 n) data-input)))
268+ (defn- unpack-map [n ^java.io.DataInput data-input opts ]
269+ (apply hash-map (unpack-n (* 2 n) data-input opts )))
270270
271271(defn unpack-stream
272272 ([^java.io.DataInput data-input] (unpack-stream data-input nil ))
341341
342342 ; array format family
343343 (= (bit-and 2r11110000 byte) 2r10010000 )
344- (unpack-n (bit-and 2r1111 byte) data-input)
344+ (unpack-n (bit-and 2r1111 byte) data-input opts )
345345
346346 (= byte 0xdc )
347- (unpack-n (read-uint16 data-input) data-input)
347+ (unpack-n (read-uint16 data-input) data-input opts )
348348
349349 (= byte 0xdd )
350- (unpack-n (read-uint32 data-input) data-input)
350+ (unpack-n (read-uint32 data-input) data-input opts )
351351
352352 ; map format family
353353 (= (bit-and 2r11110000 byte) 2r10000000 )
354- (unpack-map (bit-and 2r1111 byte) data-input)
354+ (unpack-map (bit-and 2r1111 byte) data-input opts )
355355
356356 (= byte 0xde )
357- (unpack-map (read-uint16 data-input) data-input)
357+ (unpack-map (read-uint16 data-input) data-input opts )
358358
359359 (= byte 0xdf )
360- (unpack-map (read-uint32 data-input) data-input))))
360+ (unpack-map (read-uint32 data-input) data-input opts ))))
361361
362362(defn- to-byte-array
363363 [bytes]
Original file line number Diff line number Diff line change 152152 (round-trip (unsigned-byte-array (repeat 255 0x80 )) (concat [0xc4 0xff ] (repeat 255 0x80 ))))
153153 (testing " bin 16"
154154 (round-trip (unsigned-byte-array (repeat 256 0x80 )) (concat [0xc5 0x01 0x00 ] (repeat 256 0x80 )))
155- (round-trip-raw
155+ (round-trip-raw
156156 (unsigned-byte-array (repeat 256 0x80 ))
157157 (concat [0xda 0x01 0x00 ] (repeat 256 0x80 ))
158158 (unsigned-byte-array (repeat 256 0x80 ))))
203203 (round-trip '() [0x90 ])
204204 (round-trip [] [0x90 ])
205205 (round-trip [[]] [0x91 0x90 ])
206- (round-trip [5 " abc" , true ] [0x93 0x05 0xa3 0x61 0x62 0x63 0xc3 ])
206+ (round-trip [5 " abc" true ] [0x93 0x05 0xa3 0x61 0x62 0x63 0xc3 ])
207+ (round-trip-raw [5 " abc" true ] [0x93 0x05 0xa3 0x61 0x62 0x63 0xc3 ] [5 (.getBytes " abc" ) true ])
207208 (round-trip [true 1 (msg/->Ext 100 (.getBytes " foo" )) 0xff {1 false 2 " abc" } (unsigned-byte-array [0x80 ]) [1 2 3 ] " abc" ]
208209 [0x98 0xc3 0x1 0xc7 0x3 0x64 0x66 0x6f 0x6f 0xcc 0xff 0x82 0x1 0xc2 0x2 0xa3 0x61 0x62 0x63 0xc4 0x1 0x80 0x93 0x1 0x2 0x3 0xa3 0x61 0x62 0x63 ]))
209210 (testing " array 16"
217218(deftest map-test
218219 (testing " fixmap"
219220 (round-trip {} [0x80 ])
221+ (round-trip-raw {(byte-array 0 ) [{" key" (byte-array 0 )}]}
222+ [0x81 0xa0 0x91 0x81 0xa3 0x6b 0x65 0x79 0xa0 ]
223+ {nil [{(.getBytes " key" ) nil }]})
220224 (round-trip {1 true 2 " abc" 3 (unsigned-byte-array [0x80 ])}
221225 [0x83 0x01 0xc3 0x02 0xa3 0x61 0x62 0x63 0x03 0xc4 0x01 0x80 ])
222226 (round-trip {" abc" 5 } [0x81 0xa3 0x61 0x62 0x63 0x05 ])
You can’t perform that action at this time.
0 commit comments