github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/types/type_test.go (about)

     1  // Copyright 2020 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 types
     6  
     7  import (
     8  	"testing"
     9  )
    10  
    11  func TestSSACompare(t *testing.T) {
    12  	a := []*Type{
    13  		TypeInvalid,
    14  		TypeMem,
    15  		TypeFlags,
    16  		TypeVoid,
    17  		TypeInt128,
    18  	}
    19  	for _, x := range a {
    20  		for _, y := range a {
    21  			c := x.Compare(y)
    22  			if x == y && c != CMPeq || x != y && c == CMPeq {
    23  				t.Errorf("%s compare %s == %d\n", x.extra, y.extra, c)
    24  			}
    25  		}
    26  	}
    27  }