github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/engine/interpreter/operations_test.go (about)

     1  package interpreter
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/tetratelabs/wazero/internal/testing/require"
     7  )
     8  
     9  // TestInstructionName ensures that all the operation Kind's stringer is well-defined.
    10  func TestOperationKind_String(t *testing.T) {
    11  	for k := operationKind(0); k < operationKindEnd; k++ {
    12  		require.NotEqual(t, "", k.String())
    13  	}
    14  }
    15  
    16  // Test_unionOperation_String ensures that UnionOperation's stringer is well-defined for all supported OpKinds.
    17  func Test_unionOperation_String(t *testing.T) {
    18  	op := unionOperation{}
    19  	for k := operationKind(0); k < operationKindEnd; k++ {
    20  		op.Kind = k
    21  		require.NotEqual(t, "", op.String())
    22  	}
    23  }
    24  
    25  func TestLabel(t *testing.T) {
    26  	for k := labelKind(0); k < labelKindNum; k++ {
    27  		label := newLabel(k, 12345)
    28  		require.Equal(t, k, label.Kind())
    29  		require.Equal(t, 12345, label.FrameID())
    30  	}
    31  }