github.com/muesli/go@v0.0.0-20170208044820-e410d2a81ef2/misc/cgo/test/complex.go (about)

     1  // Copyright 2016 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 cgotest
     6  
     7  /*
     8  struct {
     9  	float x;
    10  	_Complex float y;
    11  } cplxAlign = { 3.14, 2.17 };
    12  */
    13  import "C"
    14  
    15  import "testing"
    16  
    17  func TestComplexAlign(t *testing.T) {
    18  	if C.cplxAlign.x != 3.14 {
    19  		t.Errorf("got %v, expected 3.14", C.cplxAlign.x)
    20  	}
    21  	if C.cplxAlign.y != 2.17 {
    22  		t.Errorf("got %v, expected 2.17", C.cplxAlign.y)
    23  	}
    24  }