github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/testing/binaryencoding/section_test.go (about)

     1  package binaryencoding
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/tetratelabs/wazero/internal/testing/require"
     7  	"github.com/tetratelabs/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  }