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.
5 // Issue 14838. add CBytes function
12 int check_cbytes(char *b, size_t l) {
14 for (i = 0; i < l; i++) {
29 func test14838(t
*testing
.T
) {
30 data
:= []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
31 cData
:= C
.CBytes(data
)
34 if C
.check_cbytes((*C
.char
)(cData
), C
.size_t(len(data
))) == 0 {
35 t
.Fatalf("mismatched data: expected %v, got %v", data
, (*(*[10]byte)(unsafe
.Pointer(cData
)))[:])