Skip to content

Commit

Permalink
add sort tests
Browse files Browse the repository at this point in the history
  • Loading branch information
billcobbler authored and rodrigo-brito committed Oct 4, 2020
1 parent 357ccf3 commit 802a19a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions model/sort_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package model

import (
"sort"
"testing"

"github.com/magiconair/properties/assert"
)

func TestNodeSortByWidth(t *testing.T) {
nodes := []*Node{
{
Name: "second",
Width: 10.1,
},
{
Name: "third",
Width: 10.2,
},
{
Name: "first",
Width: 1,
},
}

sort.Sort(byWidth(nodes))
assert.Equal(t, nodes[0].Name, "first")
assert.Equal(t, nodes[1].Name, "second")
assert.Equal(t, nodes[2].Name, "third")
}

0 comments on commit 802a19a

Please sign in to comment.