MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/arrow/array/array_union_test.cc:38–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36using internal::checked_pointer_cast;
37
38TEST(TestUnionArray, TestSliceEquals) {
39 std::shared_ptr<RecordBatch> batch;
40 ASSERT_OK(ipc::test::MakeUnion(&batch));
41
42 auto CheckUnion = [](std::shared_ptr<Array> array) {
43 const int64_t size = array->length();
44 std::shared_ptr<Array> slice, slice2;
45 slice = array->Slice(2);
46 ASSERT_EQ(size - 2, slice->length());
47
48 slice2 = array->Slice(2);
49 ASSERT_EQ(size - 2, slice->length());
50
51 ASSERT_TRUE(slice->Equals(slice2));
52 ASSERT_TRUE(array->RangeEquals(2, array->length(), 0, slice));
53
54 // Chained slices
55 slice2 = array->Slice(1)->Slice(1);
56 ASSERT_TRUE(slice->Equals(slice2));
57
58 slice = array->Slice(1, 5);
59 slice2 = array->Slice(1, 5);
60 ASSERT_EQ(5, slice->length());
61
62 ASSERT_TRUE(slice->Equals(slice2));
63 ASSERT_TRUE(array->RangeEquals(1, 6, 0, slice));
64
65 AssertZeroPadded(*array);
66 TestInitialized(*array);
67 };
68
69 CheckUnion(batch->column(0));
70 CheckUnion(batch->column(1));
71}
72
73TEST(TestSparseUnionArray, GetFlattenedField) {
74 auto ty = sparse_union({field("ints", int64()), field("strs", utf8())}, {2, 7});

Callers

nothing calls this directly

Calls 15

MakeUnionFunction · 0.85
AssertZeroPaddedFunction · 0.85
TestInitializedFunction · 0.85
sparse_unionFunction · 0.85
ArrayFromJSONFunction · 0.85
AssertArraysEqualFunction · 0.85
RangeEqualsMethod · 0.80
GetFlattenedFieldMethod · 0.80
ASSERT_OK_AND_ASSIGNFunction · 0.70
fieldFunction · 0.50
lengthMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected