(t *testing.T)
| 204 | } |
| 205 | |
| 206 | func TestFIFO_addIfNotPresent(t *testing.T) { |
| 207 | f := NewFIFO(testFifoObjectKeyFunc) |
| 208 | |
| 209 | f.Add(mkFifoObj("a", 1)) |
| 210 | f.Add(mkFifoObj("b", 2)) |
| 211 | f.AddIfNotPresent(mkFifoObj("b", 3)) |
| 212 | f.AddIfNotPresent(mkFifoObj("c", 4)) |
| 213 | |
| 214 | if e, a := 3, len(f.items); a != e { |
| 215 | t.Fatalf("expected queue length %d, got %d", e, a) |
| 216 | } |
| 217 | |
| 218 | expectedValues := []int{1, 2, 4} |
| 219 | for _, expected := range expectedValues { |
| 220 | if actual := Pop(f).(testFifoObject).val; actual != expected { |
| 221 | t.Fatalf("expected value %d, got %d", expected, actual) |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | func TestFIFO_HasSynced(t *testing.T) { |
| 227 | tests := []struct { |
nothing calls this directly
no test coverage detected