forked from gosnmp/gosnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gosnmp_api_test.go
101 lines (85 loc) · 2.11 KB
/
gosnmp_api_test.go
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright 2012 The GoSNMP Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
// The purpose of these tests is to validate gosnmp's public APIs.
//
// IMPORTANT: If you're modifying _any_ existing code in this file, you
// should be asking yourself about API compatibility!
//go:build all || api
// +build all api
package gosnmp_test // force external view
import (
"io"
"log"
"net"
"testing"
"time"
"github.com/gosnmp/gosnmp"
)
func TestAPIConfigTypes(t *testing.T) {
g := &gosnmp.GoSNMP{}
g.Target = ""
g.Port = 0
g.Community = ""
g.Version = gosnmp.Version1
g.Version = gosnmp.Version2c
g.Timeout = time.Duration(0)
g.Retries = 0
g.MaxOids = 0
g.MaxRepetitions = 0
g.NonRepeaters = 0
g.Logger = gosnmp.NewLogger(log.New(io.Discard, "", 0))
var c net.Conn
c = g.Conn
_ = c
}
func TestAPIDefault(t *testing.T) {
var g *gosnmp.GoSNMP
g = gosnmp.Default
_ = g
}
func TestAPIConnectMethodSignature(t *testing.T) {
var f func() error
f = gosnmp.Default.Connect
_ = f
}
func TestAPIGetMethodSignature(t *testing.T) {
var f func([]string) (*gosnmp.SnmpPacket, error)
f = gosnmp.Default.Get
_ = f
}
func TestAPISetMethodSignature(t *testing.T) {
var f func([]gosnmp.SnmpPDU) (*gosnmp.SnmpPacket, error)
f = gosnmp.Default.Set
_ = f
}
func TestAPIGetNextMethodSignature(t *testing.T) {
var f func([]string) (*gosnmp.SnmpPacket, error)
f = gosnmp.Default.GetNext
_ = f
}
func TestAPIBulkWalkMethodSignature(t *testing.T) {
var f func(string, gosnmp.WalkFunc) error
f = gosnmp.Default.BulkWalk
_ = f
}
func TestAPIBulkWalkAllMethodSignature(t *testing.T) {
var f func(string) ([]gosnmp.SnmpPDU, error)
f = gosnmp.Default.BulkWalkAll
_ = f
}
func TestAPIWalkMethodSignature(t *testing.T) {
var f func(string, gosnmp.WalkFunc) error
f = gosnmp.Default.Walk
_ = f
}
func TestAPIWalkAllMethodSignature(t *testing.T) {
var f func(string) ([]gosnmp.SnmpPDU, error)
f = gosnmp.Default.WalkAll
_ = f
}
func TestAPIWalkFuncSignature(t *testing.T) {
var f gosnmp.WalkFunc
f = func(du gosnmp.SnmpPDU) (err error) { return }
_ = f
}