Skip to content

Commit

Permalink
use append instead of for loop (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
nasermirzaei89 authored and rs committed May 30, 2018
1 parent 088c5cf commit 513a561
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions id_test.go
Expand Up @@ -371,9 +371,7 @@ func TestSorter_Less(t *testing.T) {

func TestSorter_Swap(t *testing.T) {
ids := make([]ID, 0)
for _, id := range IDList {
ids = append(ids, id)
}
ids = append(ids, IDList...)
sorter := sorter(ids)
sorter.Swap(0, 1)
if got, want := ids[0], IDList[1]; !reflect.DeepEqual(got, want) {
Expand All @@ -390,9 +388,7 @@ func TestSorter_Swap(t *testing.T) {

func TestSort(t *testing.T) {
ids := make([]ID, 0)
for _, id := range IDList {
ids = append(ids, id)
}
ids = append(ids, IDList...)
Sort(ids)
if got, want := ids, []ID{IDList[1], IDList[2], IDList[0]}; !reflect.DeepEqual(got, want) {
t.Fail()
Expand Down

0 comments on commit 513a561

Please sign in to comment.