MCPcopy Create free account
hub / github.com/apache/tvm-ffi / TEST

Function TEST

tests/cpp/test_overload.cc:66–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66TEST(Reflection, CallOverloadedInitMethod) {
67 Function init_method = reflection::GetMethod("test.TestOverloadObj", "__ffi_init__");
68 Any obj_a = init_method(10); // choose the int constructor
69 EXPECT_TRUE(obj_a.as<TestOverloadObj>() != nullptr);
70 EXPECT_EQ(obj_a.as<TestOverloadObj>()->type, TestOverloadObj::Type::INT);
71 Any obj_b = init_method(3.14f); // choose the float constructor
72 EXPECT_TRUE(obj_b.as<TestOverloadObj>() != nullptr);
73 EXPECT_EQ(obj_b.as<TestOverloadObj>()->type, TestOverloadObj::Type::FLOAT);
74}
75
76TEST(Reflection, CallOverloadedMethod) {
77 Function init_method = reflection::GetMethod("test.TestOverloadObj", "__ffi_init__");

Callers

nothing calls this directly

Calls 2

GetMethodFunction · 0.85
add_oneFunction · 0.50

Tested by

no test coverage detected