MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / test

Function test

src/length.rs:229–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227
228 #[test]
229 fn test() {
230 let mut encoder = LengthEncoder::default();
231 encoder.reserve(NonZeroUsize::new(3).unwrap());
232 encoder.encode(&1);
233 encoder.encode(&255);
234 encoder.encode(&2);
235 let bytes = encoder.collect();
236
237 let mut decoder = LengthDecoder::default();
238 decoder.populate(&mut bytes.as_slice(), 3).unwrap();
239 assert_eq!(decoder.decode(), 1);
240 assert_eq!(decoder.decode(), 255);
241 assert_eq!(decoder.decode(), 2);
242 }
243
244 #[cfg(target_pointer_width = "64")] // HUGE_LEN > u32::MAX
245 #[test]

Callers

nothing calls this directly

Calls 5

as_sliceMethod · 0.80
reserveMethod · 0.45
encodeMethod · 0.45
collectMethod · 0.45
populateMethod · 0.45

Tested by

no test coverage detected