MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / createModuleCPP

Function createModuleCPP

test/plugins/unittest/unittest_cpp.cpp:34–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34std::unique_ptr<WasmEdge::Runtime::Instance::ModuleInstance> createModuleCPP() {
35 using namespace std::literals::string_view_literals;
36 WasmEdge::Plugin::Plugin::load(std::filesystem::u8path(
37 "./" WASMEDGE_LIB_PREFIX
38 "wasmedgePluginTestModuleCPP" WASMEDGE_LIB_EXTENSION));
39 if (const auto *Plugin =
40 WasmEdge::Plugin::Plugin::find("wasmedge_plugintest_cpp"sv)) {
41 WasmEdge::PO::ArgumentParser Parser;
42 Plugin->registerOptions(Parser);
43 Parser.set_raw_value<std::string>("name"sv, std::string("test_name"));
44 Parser.set_raw_value<std::vector<std::string>>(
45 "arg"sv, std::vector<std::string>({"arg0", "arg1", "arg2", "arg3"}));
46 Parser.set_raw_value("opt"sv);
47 if (const auto *Module =
48 Plugin->findModule("wasmedge_plugintest_cpp_module"sv)) {
49 return Module->create();
50 }
51 }
52 return {};
53}
54} // namespace
55
56TEST(wasmedgePluginTests, CPP_Run) {

Callers 1

TESTFunction · 0.70

Calls 5

registerOptionsMethod · 0.80
loadFunction · 0.50
set_raw_valueMethod · 0.45
findModuleMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected