(t *testing.T)
| 51 | } |
| 52 | |
| 53 | func TestDeltaFIFO_basic(t *testing.T) { |
| 54 | f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) |
| 55 | const amount = 500 |
| 56 | go func() { |
| 57 | for i := 0; i < amount; i++ { |
| 58 | f.Add(mkFifoObj(string([]rune{'a', rune(i)}), i+1)) |
| 59 | } |
| 60 | }() |
| 61 | go func() { |
| 62 | for u := uint64(0); u < amount; u++ { |
| 63 | f.Add(mkFifoObj(string([]rune{'b', rune(u)}), u+1)) |
| 64 | } |
| 65 | }() |
| 66 | |
| 67 | lastInt := int(0) |
| 68 | lastUint := uint64(0) |
| 69 | for i := 0; i < amount*2; i++ { |
| 70 | switch obj := testPop(f).val.(type) { |
| 71 | case int: |
| 72 | if obj <= lastInt { |
| 73 | t.Errorf("got %v (int) out of order, last was %v", obj, lastInt) |
| 74 | } |
| 75 | lastInt = obj |
| 76 | case uint64: |
| 77 | if obj <= lastUint { |
| 78 | t.Errorf("got %v (uint) out of order, last was %v", obj, lastUint) |
| 79 | } else { |
| 80 | lastUint = obj |
| 81 | } |
| 82 | default: |
| 83 | t.Fatalf("unexpected type %#v", obj) |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func TestDeltaFIFO_requeueOnPop(t *testing.T) { |
| 89 | f := NewDeltaFIFO(testFifoObjectKeyFunc, nil) |
nothing calls this directly
no test coverage detected