Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/compile/internal/types

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

View as plain text