Beispiel #1
0
 def test_call_i32_i64_f32_f64_f64(self):
     self.assertEqual(
         round(
             Instance(TEST_BYTES).call('i32_i64_f32_f64_f64', [
                 Value.i32(1),
                 Value.i64(2),
                 Value.f32(3.4),
                 Value.f64(5.6)
             ]), 6), 1 + 2 + 3.4 + 5.6)
Beispiel #2
0
def test_constructor():
    store = Store()
    global_ = Global(store, Value.i32(42))

    assert global_.value == 42

    type = global_.type

    assert type.type == Type.I32
    assert type.mutable == False

    global_ = Global(store, Value.i64(153), mutable=False)

    assert global_.value == 153

    type = global_.type

    assert type.type == Type.I64
    assert type.mutable == False
Beispiel #3
0
def test_i64():
    assert repr(Value.i64(42)) == 'I64(42)'
Beispiel #4
0
 def test_call_i64_i64(self):
     self.assertEqual(
         Instance(TEST_BYTES).call('i64_i64', [Value.i64(7)]), 7)
Beispiel #5
0
 def test_i64(self):
     self.assertEqual(repr(Value.i64(42)), 'I64(42)')