| 6 | using namespace wasmtime; |
| 7 | |
| 8 | TEST(Global, Smoke) { |
| 9 | Engine engine; |
| 10 | Store store(engine); |
| 11 | Global::create(store, GlobalType(ValType::i32(), true), 3.0).err(); |
| 12 | Global::create(store, GlobalType(ValType::i32(), true), 3).unwrap(); |
| 13 | Global::create(store, GlobalType(ValType::i32(), false), 3).unwrap(); |
| 14 | |
| 15 | Global g = |
| 16 | Global::create(store, GlobalType(ValType::i32(), true), 4).unwrap(); |
| 17 | EXPECT_EQ(g.get(store).i32(), 4); |
| 18 | g.set(store, 10).unwrap(); |
| 19 | EXPECT_EQ(g.get(store).i32(), 10); |
| 20 | g.set(store, 10.23).err(); |
| 21 | EXPECT_EQ(g.get(store).i32(), 10); |
| 22 | |
| 23 | EXPECT_EQ(g.type(store)->content(), ValType::i32()); |
| 24 | EXPECT_TRUE(g.type(store)->is_mutable()); |
| 25 | } |
nothing calls this directly
no test coverage detected