github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/engine/wazevo/frontend/lower_test.go (about) 1 package frontend 2 3 import ( 4 "testing" 5 "unsafe" 6 7 "github.com/bananabytelabs/wazero/internal/testing/require" 8 "github.com/bananabytelabs/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 }