Source file src/cmd/compile/internal/types/type_test.go

     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  }
    28  

View as plain text