MCPcopy Create free account
hub / github.com/OAID/Tengine / main

Function main

internal/tests/core/test/test_base_object.cpp:78–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78int main(void)
79{
80 BaseObject root;
81
82 root["obj_r0"] = "root";
83
84 root.SetClassAttr("r0", 1);
85
86 A0 a0;
87 a0.SetClassAttr("a0", 100);
88 a0["obj_a0"] = 100;
89
90 A1 a1;
91 a1.SetClassAttr("a1", 101);
92 a1["obj_a1"] = 101;
93
94 B0 b0;
95 b0.SetClassAttr("b0", 200);
96 b0["obj_b0"] = 200;
97
98 B1 b1;
99 b1.SetClassAttr("b1", 201);
100 b1["obj_b1"] = 201;
101
102 std::cout << "Attributes of root" << std::endl;
103
104 show_string_vector(root.ListAttr());
105
106 std::cout << "Attributes of a0" << std::endl;
107
108 show_string_vector(a0.ListAttr());
109
110 std::cout << "Attributes of a1" << std::endl;
111
112 show_string_vector(a1.ListAttr());
113
114 std::cout << "Attributes of b0" << std::endl;
115
116 show_string_vector(b0.ListAttr());
117
118 std::cout << "Attributes of b1" << std::endl;
119
120 show_string_vector(b1.ListAttr());
121
122 BaseObject* p_base = new B1;
123
124 show_string_vector(p_base->ListAttr());
125
126 std::cout << "b1: " << any_cast<int>((*p_base)["b1"]) << std::endl;
127
128 return 0;
129}

Callers

nothing calls this directly

Calls 3

show_string_vectorFunction · 0.85
SetClassAttrMethod · 0.80
ListAttrMethod · 0.45

Tested by

no test coverage detected