(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestTxStats_add(t *testing.T) { |
| 11 | statsA := TxStats{ |
| 12 | PageCount: 1, |
| 13 | PageAlloc: 2, |
| 14 | CursorCount: 3, |
| 15 | NodeCount: 100, |
| 16 | NodeDeref: 101, |
| 17 | Rebalance: 1000, |
| 18 | RebalanceTime: 1001 * time.Second, |
| 19 | Split: 10000, |
| 20 | Spill: 10001, |
| 21 | SpillTime: 10001 * time.Second, |
| 22 | Write: 100000, |
| 23 | WriteTime: 100001 * time.Second, |
| 24 | } |
| 25 | |
| 26 | statsB := TxStats{ |
| 27 | PageCount: 2, |
| 28 | PageAlloc: 3, |
| 29 | CursorCount: 4, |
| 30 | NodeCount: 101, |
| 31 | NodeDeref: 102, |
| 32 | Rebalance: 1001, |
| 33 | RebalanceTime: 1002 * time.Second, |
| 34 | Split: 11001, |
| 35 | Spill: 11002, |
| 36 | SpillTime: 11002 * time.Second, |
| 37 | Write: 110001, |
| 38 | WriteTime: 110010 * time.Second, |
| 39 | } |
| 40 | |
| 41 | statsB.add(&statsA) |
| 42 | assert.Equal(t, int64(3), statsB.GetPageCount()) |
| 43 | assert.Equal(t, int64(5), statsB.GetPageAlloc()) |
| 44 | assert.Equal(t, int64(7), statsB.GetCursorCount()) |
| 45 | assert.Equal(t, int64(201), statsB.GetNodeCount()) |
| 46 | assert.Equal(t, int64(203), statsB.GetNodeDeref()) |
| 47 | assert.Equal(t, int64(2001), statsB.GetRebalance()) |
| 48 | assert.Equal(t, 2003*time.Second, statsB.GetRebalanceTime()) |
| 49 | assert.Equal(t, int64(21001), statsB.GetSplit()) |
| 50 | assert.Equal(t, int64(21003), statsB.GetSpill()) |
| 51 | assert.Equal(t, 21003*time.Second, statsB.GetSpillTime()) |
| 52 | assert.Equal(t, int64(210001), statsB.GetWrite()) |
| 53 | assert.Equal(t, 210011*time.Second, statsB.GetWriteTime()) |
| 54 | } |
nothing calls this directly
no test coverage detected