github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/engine/wazevo/frontend/lower_test.go (about) 1 package frontend 2 3 import ( 4 "testing" 5 "unsafe" 6 7 "github.com/tetratelabs/wazero/internal/testing/require" 8 "github.com/tetratelabs/wazero/internal/wasm" 9 ) 10 11 func Test_Offsets(t *testing.T) { 12 var memInstance wasm.MemoryInstance 13 require.Equal(t, int(unsafe.Offsetof(memInstance.Buffer)), memoryInstanceBufOffset) 14 var tableInstance wasm.TableInstance 15 require.Equal(t, int(unsafe.Offsetof(tableInstance.References)), tableInstanceBaseAddressOffset) 16 17 var dataInstance wasm.DataInstance 18 var elementInstance wasm.ElementInstance 19 20 require.Equal(t, int(unsafe.Sizeof(dataInstance)), elementOrDataInstanceSize) 21 require.Equal(t, int(unsafe.Sizeof(elementInstance)), elementOrDataInstanceSize) 22 }