fix test
This commit is contained in:
parent
9b03c64577
commit
f4936d4547
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -81,6 +82,14 @@ func TestMemoryItem(t *testing.T) {
|
||||||
if len(actItems) != 2 {
|
if len(actItems) != 2 {
|
||||||
t.Errorf("exp 2, gor %d", len(actItems))
|
t.Errorf("exp 2, gor %d", len(actItems))
|
||||||
}
|
}
|
||||||
|
sort.Slice(actItems, func(i, j int) bool {
|
||||||
|
return actItems[i].ID < actItems[j].ID
|
||||||
|
})
|
||||||
|
expItems := []item.Item{t1, t2}
|
||||||
|
sort.Slice(expItems, func(i, j int) bool {
|
||||||
|
return expItems[i].ID < actItems[j].ID
|
||||||
|
})
|
||||||
|
|
||||||
if actItems[0].ID != t1.ID {
|
if actItems[0].ID != t1.ID {
|
||||||
t.Errorf("exp %v, got %v", actItems[0].ID, t1.ID)
|
t.Errorf("exp %v, got %v", actItems[0].ID, t1.ID)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue