MCPcopy Create free account
hub / github.com/NetSys/bess / TEST_F

Function TEST_F

core/shared_obj_test.cc:63–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61};
62
63TEST_F(Test, Basic) {
64 std::shared_ptr<FooType> ref_a = shared_objects.Get<FooType>("foo");
65 ASSERT_EQ(num_constructed, 1);
66
67 std::shared_ptr<FooType> ref_b = shared_objects.Get<FooType>("foo");
68 ASSERT_EQ(num_constructed, 1);
69 ASSERT_EQ(ref_a, ref_b);
70 ASSERT_EQ(num_destructed, 0);
71
72 ref_a.reset();
73 ASSERT_EQ(num_constructed, 1);
74 ASSERT_EQ(num_destructed, 0); // ref_b is still holding a reference
75 ASSERT_NE(ref_a, ref_b);
76
77 ref_b.reset();
78 ASSERT_EQ(num_destructed, 1);
79 ASSERT_EQ(ref_a, ref_b);
80}
81
82TEST_F(Test, MultipleObjects) {
83 std::shared_ptr<FooType> ref_a = shared_objects.Get<FooType>("foo1");

Callers

nothing calls this directly

Calls 2

deferred_argFunction · 0.85
resetMethod · 0.45

Tested by

no test coverage detected