MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / TEST

Function TEST

oneflow/core/intrusive/flat_msg_test.cpp:50–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48// clang-format on
49
50TEST(FlatMsg, optional) {
51 static_assert(std::is_trivial<TestOptional>::value, "TestOptional is not trivial");
52 FlatMsg<TestOptional> foo_box;
53 auto& foo = *foo_box.Mutable();
54 ASSERT_TRUE(!foo.has_bar());
55 ASSERT_EQ(foo.bar(), 0);
56 ASSERT_TRUE(GetFieldNames(&foo).empty());
57 *foo.mutable_bar() = 9527;
58 ASSERT_TRUE(foo.has_bar());
59 ASSERT_EQ(foo.bar(), 9527);
60 auto field_names = GetFieldNames(&foo);
61 ASSERT_EQ(field_names.size(), 1);
62 ASSERT_EQ(field_names.at(0), "bar_");
63}
64
65// clang-format off
66FLAT_MSG_BEGIN(FooOneof)

Callers 1

flat_msg_test.cppFile · 0.70

Calls 7

GetFieldNamesFunction · 0.85
CheckSoleFieldNameFunction · 0.85
barMethod · 0.80
MutableMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected