[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use append instead of for loop in test #37

Merged
merged 1 commit into from
May 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
use append instead of for loop
  • Loading branch information
nasermirzaei89 committed May 30, 2018
commit 1211541fc98feb23ba796be720c15b4b328d3e81
8 changes: 2 additions & 6 deletions id_test.go
Original file line number Diff line number Diff line change
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