seqmap: re-order test asserts
Reorder seqmap asserts to properly show display expected and actual when performing go test -v ./... Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
d925ac8f72
commit
23ee64b057
1 changed files with 15 additions and 15 deletions
|
@ -14,43 +14,43 @@ func TestSeqMap(t *testing.T) {
|
||||||
var found bool
|
var found bool
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
assert.Equal(seqmap.Size(), 0)
|
assert.Equal(0, seqmap.Size())
|
||||||
|
|
||||||
_, found = seqmap.Get(42)
|
_, found = seqmap.Get(42)
|
||||||
assert.Equal(found, false)
|
assert.Equal(false, found)
|
||||||
|
|
||||||
_, found = seqmap.Pop(0)
|
_, found = seqmap.Pop(0)
|
||||||
assert.Equal(found, false)
|
assert.Equal(false, found)
|
||||||
|
|
||||||
seqmap.Put(1, 1337)
|
seqmap.Put(1, 1337)
|
||||||
seqmap.Put(2, 42)
|
seqmap.Put(2, 42)
|
||||||
seqmap.Put(3, 1107)
|
seqmap.Put(3, 1107)
|
||||||
assert.Equal(seqmap.Size(), 3)
|
assert.Equal(3, seqmap.Size())
|
||||||
|
|
||||||
_, found = seqmap.Pop(0)
|
_, found = seqmap.Pop(0)
|
||||||
assert.Equal(found, false)
|
assert.Equal(false, found)
|
||||||
|
|
||||||
uid, found = seqmap.Get(1)
|
uid, found = seqmap.Get(1)
|
||||||
assert.Equal(uid, uint32(1337))
|
assert.Equal(uint32(1337), uid)
|
||||||
assert.Equal(found, true)
|
assert.Equal(true, found)
|
||||||
|
|
||||||
uid, found = seqmap.Pop(1)
|
uid, found = seqmap.Pop(1)
|
||||||
assert.Equal(uid, uint32(1337))
|
assert.Equal(uint32(1337), uid)
|
||||||
assert.Equal(found, true)
|
assert.Equal(true, found)
|
||||||
assert.Equal(seqmap.Size(), 2)
|
assert.Equal(2, seqmap.Size())
|
||||||
|
|
||||||
// Repop the same seqnum should work because of the syncing
|
// Repop the same seqnum should work because of the syncing
|
||||||
_, found = seqmap.Pop(1)
|
_, found = seqmap.Pop(1)
|
||||||
assert.Equal(found, true)
|
assert.Equal(true, found)
|
||||||
assert.Equal(seqmap.Size(), 1)
|
assert.Equal(1, seqmap.Size())
|
||||||
|
|
||||||
// sync means we already have a 1. This is replacing that UID so the size
|
// sync means we already have a 1. This is replacing that UID so the size
|
||||||
// shouldn't increase
|
// shouldn't increase
|
||||||
seqmap.Put(1, 7331)
|
seqmap.Put(1, 7331)
|
||||||
assert.Equal(seqmap.Size(), 1)
|
assert.Equal(1, seqmap.Size())
|
||||||
|
|
||||||
seqmap.Clear()
|
seqmap.Clear()
|
||||||
assert.Equal(seqmap.Size(), 0)
|
assert.Equal(0, seqmap.Size())
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -77,5 +77,5 @@ func TestSeqMap(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
assert.Equal(seqmap.Size(), 0)
|
assert.Equal(0, seqmap.Size())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue