| 166 | using namespace std::literals; |
| 167 | |
| 168 | TEST(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 | |
| 198 | TEST(AsyncExecute, GasThreadTest) { |
| 199 | WasmEdge::Configure Conf; |
nothing calls this directly
no test coverage detected