Home | History | Annotate | Download | only in test
      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 const long long issue5603exp = 0x12345678;
      9 long long issue5603foo0() { return issue5603exp; }
     10 long long issue5603foo1(void *p) { return issue5603exp; }
     11 long long issue5603foo2(void *p, void *q) { return issue5603exp; }
     12 long long issue5603foo3(void *p, void *q, void *r) { return issue5603exp; }
     13 long long issue5603foo4(void *p, void *q, void *r, void *s) { return issue5603exp; }
     14 */
     15 import "C"
     16 
     17 import "testing"
     18 
     19 func test5603(t *testing.T) {
     20 	var x [5]int64
     21 	exp := int64(C.issue5603exp)
     22 	x[0] = int64(C.issue5603foo0())
     23 	x[1] = int64(C.issue5603foo1(nil))
     24 	x[2] = int64(C.issue5603foo2(nil, nil))
     25 	x[3] = int64(C.issue5603foo3(nil, nil, nil))
     26 	x[4] = int64(C.issue5603foo4(nil, nil, nil, nil))
     27 	for i, v := range x {
     28 		if v != exp {
     29 			t.Errorf("issue5603foo%d() returns %v, expected %v", i, v, exp)
     30 		}
     31 	}
     32 }
     33