MCPcopy Create free account
hub / github.com/catboost/catboost / CompareNameValueItems

Function CompareNameValueItems

tools/enum_parser/parse_enum/parse_enum_ut.cpp:16–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14 using TNameValuePair = std::pair<TStringBuf, TMaybe<TStringBuf>>;
15
16 void CompareNameValueItems(TConstArrayRef<TNameValuePair> ref, const TEnum& e) {
17 const TItems& it = e.Items;
18 for (size_t i = 0; i < Min(ref.size(), it.size()); ++i) {
19 const auto& [refCppName, refValue] = ref[i];
20 UNIT_ASSERT_VALUES_EQUAL_C(it[i].CppName, refCppName, e.CppName);
21 UNIT_ASSERT_EQUAL_C(it[i].Value.Defined(), refValue.Defined(), e.CppName);
22 if (refValue.Defined() && it[i].Value.Defined()) {
23 UNIT_ASSERT_VALUES_EQUAL_C(*it[i].Value, *refValue, e.CppName);
24 }
25 }
26 UNIT_ASSERT_VALUES_EQUAL_C(it.size(), ref.size(), e.CppName);
27 }
28}
29
30Y_UNIT_TEST_SUITE(TEnumParserTest) {

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 3

MinFunction · 0.50
sizeMethod · 0.45
DefinedMethod · 0.45

Tested by

no test coverage detected