github.com/4ad/go@v0.0.0-20161219182952-69a12818b605/misc/cgo/test/issue6833.go (about)

     1  // Copyright 2013 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  extern unsigned long long issue6833Func(unsigned int, unsigned long long);
     9  */
    10  import "C"
    11  
    12  import "testing"
    13  
    14  //export GoIssue6833Func
    15  func GoIssue6833Func(aui uint, aui64 uint64) uint64 {
    16  	return aui64 + uint64(aui)
    17  }
    18  
    19  func test6833(t *testing.T) {
    20  	ui := 7
    21  	ull := uint64(0x4000300020001000)
    22  	v := uint64(C.issue6833Func(C.uint(ui), C.ulonglong(ull)))
    23  	exp := uint64(ui) + ull
    24  	if v != exp {
    25  		t.Errorf("issue6833Func() returns %x, expected %x", v, exp)
    26  	}
    27  }