-
-
Notifications
You must be signed in to change notification settings - Fork 238
/
wasm_test.cc
39 lines (31 loc) · 1.12 KB
/
wasm_test.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include "gtest/gtest.h"
#include "v8.h"
#include "libplatform/libplatform.h"
#include "v8_test_fixture.h"
#include "src/wasm/wasm-engine.h"
#include "src/execution/isolate.h"
#include "src/execution/isolate-inl.h"
using namespace v8;
namespace i = v8::internal;
class WasmTest : public V8TestFixture {};
bool module_callback(const FunctionCallbackInfo<Value>&) {
std::cout << "wasm_module_callback...\n";
return false;
}
TEST_F(WasmTest, engine) {
Isolate::Scope isolate_scope(isolate_);
const v8::HandleScope handle_scope(isolate_);
i::Isolate* i_isolate = asInternal(isolate_);
i::wasm::WasmEngine* engine = i_isolate->wasm_engine();
std::shared_ptr<i::wasm::WasmEngine> engine2 = i::wasm::WasmEngine::GetWasmEngine();
i_isolate->set_wasm_module_callback(module_callback);
//TODO: Compile and call module function
}
TEST_F(WasmTest, ValueType) {
Isolate::Scope isolate_scope(isolate_);
const v8::HandleScope handle_scope(isolate_);
i::Isolate* i_isolate = asInternal(isolate_);
i::wasm::ValueType anyref(i::wasm::ValueType::Kind::kAnyRef);
EXPECT_EQ(i::wasm::kWasmAnyRef, anyref);
}