Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2654)

Delta Between Two Patch Sets: misc/cgo/test/basic.go

Issue 6853059: code review 6853059: cgo: enable cgo on openbsd (Closed)
Left Patch Set: diff -r bb031a90ceea https://go.googlecode.com/hg/ Created 11 years, 4 months ago
Right Patch Set: diff -r e08535d6901d https://go.googlecode.com/hg/ Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « doc/progs/run ('k') | src/pkg/go/build/build.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Basic test cases for cgo. 5 // Basic test cases for cgo.
6 6
7 package cgotest 7 package cgotest
8 8
9 /* 9 /*
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 t.Fatalf("C.fopen: should fail") 113 t.Fatalf("C.fopen: should fail")
114 } 114 }
115 if err != syscall.ENOENT { 115 if err != syscall.ENOENT {
116 t.Fatalf("C.fopen: unexpected error: %v", err) 116 t.Fatalf("C.fopen: unexpected error: %v", err)
117 } 117 }
118 } 118 }
119 119
120 func testMultipleAssign(t *testing.T) { 120 func testMultipleAssign(t *testing.T) {
121 p := C.CString("234") 121 p := C.CString("234")
122 n, m := C.strtol(p, nil, 345), C.strtol(p, nil, 10) 122 n, m := C.strtol(p, nil, 345), C.strtol(p, nil, 10)
123 nl, ml := C.long(0), C.long(234)
124 if runtime.GOOS == "openbsd" { 123 if runtime.GOOS == "openbsd" {
125 » » // Bug in OpenBSD's strtol(3) - base > 36 is still valid. 124 » » // Bug in OpenBSD strtol(3) - base > 36 succeeds.
126 » » nl = 239089 125 » » if (n != 0 && n != 239089) || m != 234 {
127 » } 126 » » » t.Fatal("Strtol x2: ", n, m)
128 » if n != nl || m != ml { 127 » » }
128 » } else if n != 0 || m != 234 {
129 t.Fatal("Strtol x2: ", n, m) 129 t.Fatal("Strtol x2: ", n, m)
130 } 130 }
131 C.free(unsafe.Pointer(p)) 131 C.free(unsafe.Pointer(p))
132 } 132 }
133 133
134 var ( 134 var (
135 cuint = (C.uint)(0) 135 cuint = (C.uint)(0)
136 culong C.ulong 136 culong C.ulong
137 cchar C.char 137 cchar C.char
138 ) 138 )
(...skipping 11 matching lines...) Expand all
150 } 150 }
151 151
152 // Issue 2470. 152 // Issue 2470.
153 func testUnsignedInt(t *testing.T) { 153 func testUnsignedInt(t *testing.T) {
154 a := (int64)(C.UINT32VAL) 154 a := (int64)(C.UINT32VAL)
155 b := (int64)(0xc008427b) 155 b := (int64)(0xc008427b)
156 if a != b { 156 if a != b {
157 t.Errorf("Incorrect unsigned int - got %x, want %x", a, b) 157 t.Errorf("Incorrect unsigned int - got %x, want %x", a, b)
158 } 158 }
159 } 159 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b