added test for Query return size
Dane Harrigan authored 9 years ago
Blake Mizerany committed 9 years ago
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | ||
39 | func TestQuery(t *testing.T) { | |
40 | queryTests := []struct { | |
41 | value string | |
42 | expected int | |
43 | }{ | |
44 | {"a", 1}, | |
45 | {"b", 2}, | |
46 | {"c", 2}, | |
47 | } | |
48 | ||
49 | stream := New(2) | |
50 | for _, tt := range queryTests { | |
51 | stream.Insert(tt.value) | |
52 | if n := len(stream.Query()); n != tt.expected { | |
53 | t.Errorf("want %d, got %d", tt.expected, n) | |
54 | } | |
55 | } | |
56 | } |