-
Notifications
You must be signed in to change notification settings - Fork 94
/
sock_option_test.gsl
83 lines (75 loc) · 2.28 KB
/
sock_option_test.gsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.# This is a code generator built using the iMatix GSL code generation
.# language. See https://github.com/imatix/gsl for details. This script
.# is licensed under MIT/X11.
.#
.output "./sock_option_test.go"
//go:generate gsl sockopts.xml
package goczmq
/* =========================================================================
zsock_option - get/set 0MQ socket options
****************************************************
* GENERATED SOURCE CODE, DO NOT EDIT!! *
****************************************************
Copyright (c) the Contributors as noted in the AUTHORS file.
This file is part of goczmq, the high-level go binding for CZMQ:
https://github.com/zeromq/goczmq
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
=========================================================================
*/
import (
"testing"
)
.for version
.if major = "4"
.for option where defined(test)
.if mode = "rw" | mode = "w"
.if type = "uint64" | type = "int64" | type = "uint32" | type = "int"
func Test$(name:pascal)(t *testing.T) {
sock := NewSock($(test:neat))
testval := $(test_value?'1':)
sock.SetOption(SockSet$(name:pascal)(testval))
.if mode = "rw"
val := $(name:pascal)(sock)
if val != testval && val != 0 {
t.Errorf("$(name:pascal) returned %d, should be %d", val, testval)
}
.endif
sock.Destroy()
}
.endif
.if type = "string" | type = "key"
func Test$(name:pascal)(t *testing.T) {
sock := NewSock($(test:neat))
testval := "$(test_value?'test':)"
sock.SetOption(SockSet$(name:pascal)(testval))
.if mode = "rw"
val := $(name:pascal)(sock)
if val != testval && val != "" {
t.Errorf("$(name:pascal) returned %s should be %s", val, testval)
}
.endif
sock.Destroy()
}
.endif
.if mode = "r"
.if type = "uint64" | type = "int64" | type = "uint32" | type = "int"
func Test$(name:pascal)(t *testing.T) {
sock := NewSock($(test:neat))
_ = $(name:pascal)(sock)
sock.Destroy()
}
.endif
.if type = "string" | type = "key"
func Test$(name:pascal)(t *testing.T) {
sock := NewSock($(test:pascal))
_ = sock.$(name:pascal)()
sock.Destroy()
}
.endif
.endif
.endif
.endfor
.endif
.endfor