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

Function test_string_view_equal

arrow/tests/array_equal.rs:317–358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

315
316#[test]
317fn test_string_view_equal() {
318 let a1 = StringViewArray::from(vec!["foo", "very long string over 12 bytes", "bar"]);
319 let a2 = StringViewArray::from(vec![
320 "a very long string over 12 bytes",
321 "foo",
322 "very long string over 12 bytes",
323 "bar",
324 ]);
325 test_equal(&a1, &a2.slice(1, 3), true);
326
327 let a1 = StringViewArray::from(vec!["foo", "very long string over 12 bytes", "bar"]);
328 let a2 = StringViewArray::from(vec!["foo", "very long string over 12 bytes", "bar"]);
329 test_equal(&a1, &a2, true);
330
331 let a1_s = a1.slice(1, 1);
332 let a2_s = a2.slice(1, 1);
333 test_equal(&a1_s, &a2_s, true);
334
335 let a1_s = a1.slice(2, 1);
336 let a2_s = a2.slice(0, 1);
337 test_equal(&a1_s, &a2_s, false);
338
339 // test will null value.
340 let a1 = StringViewArray::from(vec!["foo", "very long string over 12 bytes", "bar"]);
341 let a2 = {
342 let mut builder = StringViewBuilder::new();
343 builder.append_value("foo");
344 builder.append_null();
345 builder.append_option(Some("very long string over 12 bytes"));
346 builder.append_value("bar");
347 builder.finish()
348 };
349 test_equal(&a1, &a2, false);
350
351 let a1_s = a1.slice(1, 2);
352 let a2_s = a2.slice(1, 3);
353 test_equal(&a1_s, &a2_s, false);
354
355 let a1_s = a1.slice(1, 2);
356 let a2_s = a2.slice(2, 2);
357 test_equal(&a1_s, &a2_s, true);
358}
359
360#[test]
361fn test_string_offset() {

Callers

nothing calls this directly

Calls 6

test_equalFunction · 0.85
sliceMethod · 0.45
append_valueMethod · 0.45
append_nullMethod · 0.45
append_optionMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected