MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_extend_trusted_len_then_append

Function test_extend_trusted_len_then_append

arrow-buffer/src/buffer/boolean.rs:1238–1249  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1236
1237 #[test]
1238 fn test_extend_trusted_len_then_append() {
1239 // Exercises append after extend_trusted_len to validate byte length and values.
1240 let mut builder = BooleanBufferBuilder::new(0);
1241 let bools: Vec<_> = (0..9).map(|i| i % 3 == 0).collect();
1242 unsafe { builder.extend_trusted_len(bools.clone().into_iter()) };
1243 builder.append(true);
1244 assert_eq!(builder.as_slice().len(), bit_util::ceil(builder.len(), 8));
1245 let finished = builder.finish();
1246 for (i, v) in bools.into_iter().chain(std::iter::once(true)).enumerate() {
1247 assert_eq!(finished.value(i), v, "at index {}", i);
1248 }
1249 }
1250
1251 #[test]
1252 fn test_find_nth_set_bit_position() {

Callers

nothing calls this directly

Calls 6

collectMethod · 0.80
extend_trusted_lenMethod · 0.80
into_iterMethod · 0.45
cloneMethod · 0.45
appendMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected