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

Function CheckTypeIdReprs

cpp/src/arrow/type_test.cc:78–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76
77template <typename ReprFunc>
78void CheckTypeIdReprs(ReprFunc&& repr_func, bool expect_uppercase) {
79 std::unordered_set<std::string> unique_reprs;
80 const auto all_ids = AllTypeIds();
81 for (const auto id : all_ids) {
82 std::string repr = repr_func(id);
83 ASSERT_TRUE(std::all_of(repr.begin(), repr.end(),
84 [=](const char c) {
85 return c == '_' || std::isdigit(c) ||
86 (expect_uppercase ? std::isupper(c)
87 : std::islower(c));
88 }))
89 << "Invalid type id repr: '" << repr << "'";
90 unique_reprs.insert(std::move(repr));
91 }
92 // No duplicates
93 ASSERT_EQ(unique_reprs.size(), all_ids.size());
94}
95
96TEST(TestTypeId, ToString) {
97 // Should be all uppercase strings (corresponding to the enum member names)

Callers 1

TESTFunction · 0.85

Calls 5

AllTypeIdsFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected