File: generic_test.go

package info (click to toggle)
golang-github-gobwas-pool 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 116 kB
  • sloc: makefile: 2
file content (33 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (2)
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
package pool

import "testing"

func TestGenericPoolGet(t *testing.T) {
	for _, test := range []struct {
		name     string
		min, max int
		get      int
		expSize  int
	}{
		{
			min:     0,
			max:     1,
			get:     10,
			expSize: 10,
		},
		{
			min:     0,
			max:     16,
			get:     10,
			expSize: 16,
		},
	} {
		t.Run(test.name, func(t *testing.T) {
			p := New(test.min, test.max)
			_, n := p.Get(test.get)
			if n != test.expSize {
				t.Errorf("Get(%d) = _, %d; want %d", test.get, n, test.expSize)
			}
		})
	}
}