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

Function TEST

cpp/src/arrow/util/stl_util_test.cc:32–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace internal {
31
32TEST(StlUtilTest, VectorAddRemoveTest) {
33 std::vector<int> values;
34 std::vector<int> result = AddVectorElement(values, 0, 100);
35 EXPECT_EQ(values.size(), 0);
36 EXPECT_EQ(result.size(), 1);
37 EXPECT_EQ(result[0], 100);
38
39 // Add 200 at index 0 and 300 at the end.
40 std::vector<int> result2 = AddVectorElement(result, 0, 200);
41 result2 = AddVectorElement(result2, result2.size(), 300);
42 EXPECT_EQ(result.size(), 1);
43 EXPECT_EQ(result2.size(), 3);
44 EXPECT_EQ(result2[0], 200);
45 EXPECT_EQ(result2[1], 100);
46 EXPECT_EQ(result2[2], 300);
47
48 // Remove 100, 300, 200
49 std::vector<int> result3 = DeleteVectorElement(result2, 1);
50 EXPECT_EQ(result2.size(), 3);
51 EXPECT_EQ(result3.size(), 2);
52 EXPECT_EQ(result3[0], 200);
53 EXPECT_EQ(result3[1], 300);
54
55 result3 = DeleteVectorElement(result3, 1);
56 EXPECT_EQ(result3.size(), 1);
57 EXPECT_EQ(result3[0], 200);
58
59 result3 = DeleteVectorElement(result3, 0);
60 EXPECT_TRUE(result3.empty());
61}
62
63void ExpectSortPermutation(std::vector<std::string> unsorted,
64 std::vector<int64_t> expected_indices,

Callers

nothing calls this directly

Calls 15

AddVectorElementFunction · 0.85
DeleteVectorElementFunction · 0.85
ExpectSortPermutationFunction · 0.85
FlattenVectorsFunction · 0.85
FilterVectorFunction · 0.85
MapVectorFunction · 0.85
to_stringFunction · 0.85
MaybeMapVectorFunction · 0.85
IOErrorFunction · 0.85
UnwrapOrRaiseFunction · 0.85
push_backMethod · 0.80
emplace_backMethod · 0.80

Tested by

no test coverage detected