github.com/tencent/goom@v1.0.1/internal/arch/x86asm/inst_test.go (about)

     1  // Copyright 2014 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package x86asm
     6  
     7  import (
     8  	"strings"
     9  	"testing"
    10  )
    11  
    12  // TestRegString TestRegString
    13  func TestRegString(t *testing.T) {
    14  	for r := Reg(1); r <= regMax; r++ {
    15  		if regNames[r] == "" {
    16  			t.Errorf("regNames[%d] is missing", int(r))
    17  		} else if s := r.String(); strings.Contains(s, "Reg(") {
    18  			t.Errorf("Reg(%d).String() = %s, want proper name", int(r), s)
    19  		}
    20  	}
    21  }