github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/wazeroir/operations_test.go (about)

     1  package wazeroir
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/wasilibs/wazerox/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  // TestUnionOperation_String ensures that UnionOperation's stringer is well-defined for all supported OpKinds.
    17  func TestUnionOperation_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  }