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

Function TEST

test/thread/ThreadTest.cpp:168–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166using namespace std::literals;
167
168TEST(AsyncExecute, ThreadTest) {
169 WasmEdge::Configure Conf;
170 WasmEdge::VM::VM VM(Conf);
171 ASSERT_TRUE(VM.loadWasm(MersenneTwister19937));
172 ASSERT_TRUE(VM.validate());
173 ASSERT_TRUE(VM.instantiate());
174 {
175 std::array<WasmEdge::Async<WasmEdge::Expect<std::vector<
176 std::pair<WasmEdge::ValVariant, WasmEdge::ValType>>>>,
177 4>
178 AsyncResults;
179 for (uint64_t Index = 0; Index < Answers.size(); ++Index) {
180 AsyncResults[Index] =
181 VM.asyncExecute("mt19937",
182 std::initializer_list<WasmEdge::ValVariant>{
183 UINT32_C(2504) * static_cast<uint32_t>(Index),
184 UINT64_C(5489), UINT64_C(100000) + Index},
185 {WasmEdge::ValType(WasmEdge::TypeCode::I32),
186 WasmEdge::ValType(WasmEdge::TypeCode::I64),
187 WasmEdge::ValType(WasmEdge::TypeCode::I64)});
188 }
189 for (uint64_t Index = 0; Index < Answers.size(); ++Index) {
190 auto Result = AsyncResults[Index].get();
191 ASSERT_TRUE(Result);
192 ASSERT_EQ((*Result)[0].second.getCode(), WasmEdge::TypeCode::I64);
193 EXPECT_EQ((*Result)[0].first.get<uint64_t>(), Answers[Index]);
194 }
195 }
196}
197
198TEST(AsyncExecute, GasThreadTest) {
199 WasmEdge::Configure Conf;

Callers

nothing calls this directly

Calls 15

ValTypeClass · 0.85
loadWasmMethod · 0.80
setCostMeasuringMethod · 0.80
setTimeMeasuringMethod · 0.80
setInterruptibleMethod · 0.80
setOutputFormatMethod · 0.80
checkConfigureMethod · 0.80
parseModuleMethod · 0.80
codegenMethod · 0.80
cleanupMethod · 0.80
validateMethod · 0.45

Tested by

no test coverage detected