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

Function test_interface

internal/tests/core/test/test_factory.cpp:246–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void test_interface()
247{
248 SpecificFactory<base>* p_fc = SpecificFactory<base>::GetFactory();
249
250 p_fc->RegisterInterface<A>("A");
251 p_fc->RegisterInterface<A, int>("A");
252 p_fc->RegisterInterface<B>("B");
253 p_fc->RegisterInterface<B, int>("B");
254 p_fc->RegisterInterface<B, int, const std::string&>("B");
255 p_fc->RegisterInterface<B, int, std::string&&>("B");
256
257 std::cout << "Now, test create...\n";
258
259 base* p_base;
260
261 p_base = p_fc->Create("A");
262 p_base->f();
263
264 p_base = p_fc->Create("A", 102);
265 p_base->f();
266
267 const std::string& str = "lval";
268 p_base = p_fc->Create("B", 100, str);
269
270 p_base->f();
271 p_base->g();
272
273 p_base = p_fc->Create<int, std::string&&>("B", 200, "rval");
274
275 p_base->f();
276 p_base->g();
277}
278
279int main(void)
280{

Callers 1

mainFunction · 0.85

Calls 3

CreateMethod · 0.45
fMethod · 0.45
gMethod · 0.45

Tested by

no test coverage detected