Codebase list golang-github-beorn7-perks / 6cb9d9d
added test for Query return size Dane Harrigan authored 9 years ago Blake Mizerany committed 9 years ago
1 changed file(s) with 19 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3535 }
3636 }
3737 }
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 }