github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/testing/binaryencoding/section_test.go (about) 1 package binaryencoding 2 3 import ( 4 "testing" 5 6 "github.com/bananabytelabs/wazero/internal/testing/require" 7 "github.com/bananabytelabs/wazero/internal/wasm" 8 ) 9 10 func TestEncodeFunctionSection(t *testing.T) { 11 require.Equal(t, []byte{wasm.SectionIDFunction, 0x2, 0x01, 0x05}, EncodeFunctionSection([]wasm.Index{5})) 12 } 13 14 // TestEncodeStartSection uses the same index as TestEncodeFunctionSection to highlight the encoding is different. 15 func TestEncodeStartSection(t *testing.T) { 16 require.Equal(t, []byte{wasm.SectionIDStart, 0x01, 0x05}, EncodeStartSection(5)) 17 }