MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / TestSerialNumberSetSmoke

Function TestSerialNumberSetSmoke

auth/cert_test.go:74–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestSerialNumberSetSmoke(t *testing.T) {
75 const testFile = `
7601:00:00:00:00 # test
77# test 2
7803
7903
80
8100
82 01
8302`
84 testcases := []serialNumberSetTestcase{
85 {
86 input: big.NewInt(1 << 32),
87 output: true,
88 },
89 {
90 input: big.NewInt(0),
91 output: true,
92 },
93 {
94 input: big.NewInt(1),
95 output: true,
96 },
97 {
98 input: big.NewInt(2),
99 output: true,
100 },
101 {
102 input: big.NewInt(3),
103 output: true,
104 },
105 {
106 input: big.NewInt(4),
107 output: false,
108 },
109 {
110 input: big.NewInt(-2),
111 output: true,
112 },
113 }
114 s, err := newSerialNumberSetFromReader(strings.NewReader(testFile), nil)
115 if err != nil {
116 t.Fatalf("unable to load test set: %v", err)
117 }
118 for i, testcase := range testcases {
119 t.Run(fmt.Sprintf("Testcase[%d]", i), func(t *testing.T) {
120 out := s.Has(testcase.input)
121 if out != testcase.output {
122 t.Fatalf("expected %v, got %v", testcase.output, out)
123 }
124 })
125 }
126}
127
128func TestSerialNumberSetEmpty(t *testing.T) {
129 const testFile = ""

Callers

nothing calls this directly

Calls 3

FatalfMethod · 0.80
HasMethod · 0.45

Tested by

no test coverage detected