Ensure object count doesn't change suring sorting
This commit is contained in:
parent
abcfa7cb24
commit
61f4e1172a
1 changed files with 4 additions and 0 deletions
|
|
@ -71,6 +71,10 @@ func TestSortObjects(t *testing.T) {
|
||||||
|
|
||||||
sortObjects(allObjects)
|
sortObjects(allObjects)
|
||||||
|
|
||||||
|
if len(allObjects) != len(expectedOrder) {
|
||||||
|
t.Fatal("number of objects changed while sorting")
|
||||||
|
}
|
||||||
|
|
||||||
for i := 0; i < len(allObjects); i++ {
|
for i := 0; i < len(allObjects); i++ {
|
||||||
if allObjects[i].GetID() != expectedOrder[i].GetID() {
|
if allObjects[i].GetID() != expectedOrder[i].GetID() {
|
||||||
t.Fatalf("object order differs at index %d, got '%s' expected '%s'", i, allObjects[i].GetID(), expectedOrder[i].GetID())
|
t.Fatalf("object order differs at index %d, got '%s' expected '%s'", i, allObjects[i].GetID(), expectedOrder[i].GetID())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue