all: gofmt

Run standard gofmt command on project root.

- go version go1.10.3 darwin/amd64

Signed-off-by: ia <isaac.ardis@gmail.com>
pull/78/head
ia 7 years ago
parent b2394dfbb6
commit 55e94ab1e3

@ -99,17 +99,18 @@ func (list *List) Values() []interface{} {
} }
//IndexOf returns index of provided element //IndexOf returns index of provided element
func (list *List) IndexOf(value interface{}) int{ func (list *List) IndexOf(value interface{}) int {
if list.size == 0 { if list.size == 0 {
return -1 return -1
} }
for index, element := range list.elements { for index, element := range list.elements {
if element == value { if element == value {
return index return index
}
} }
return -1 }
return -1
} }
// Empty returns true if list does not contain any elements. // Empty returns true if list does not contain any elements.
func (list *List) Empty() bool { func (list *List) Empty() bool {
return list.size == 0 return list.size == 0

@ -30,26 +30,26 @@ func TestListIndexOf(t *testing.T) {
list := New() list := New()
expectedIndex := -1 expectedIndex := -1
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
list.Add("a") list.Add("a")
list.Add("b", "c") list.Add("b", "c")
expectedIndex = 0 expectedIndex = 0
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 1 expectedIndex = 1
if index := list.IndexOf("b"); index != expectedIndex{ if index := list.IndexOf("b"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 2 expectedIndex = 2
if index := list.IndexOf("c"); index != expectedIndex{ if index := list.IndexOf("c"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
} }

@ -185,6 +185,7 @@ func (list *List) IndexOf(value interface{}) int {
} }
return -1 return -1
} }
// Empty returns true if list does not contain any elements. // Empty returns true if list does not contain any elements.
func (list *List) Empty() bool { func (list *List) Empty() bool {
return list.size == 0 return list.size == 0

@ -137,26 +137,26 @@ func TestListIndexOf(t *testing.T) {
list := New() list := New()
expectedIndex := -1 expectedIndex := -1
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
list.Add("a") list.Add("a")
list.Add("b", "c") list.Add("b", "c")
expectedIndex = 0 expectedIndex = 0
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 1 expectedIndex = 1
if index := list.IndexOf("b"); index != expectedIndex{ if index := list.IndexOf("b"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 2 expectedIndex = 2
if index := list.IndexOf("c"); index != expectedIndex{ if index := list.IndexOf("c"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
} }

@ -155,7 +155,7 @@ func (list *List) Values() []interface{} {
} }
//IndexOf returns index of provided element //IndexOf returns index of provided element
func (list *List) IndexOf(value interface{}) int{ func (list *List) IndexOf(value interface{}) int {
if list.size == 0 { if list.size == 0 {
return -1 return -1
} }
@ -166,6 +166,7 @@ func (list *List) IndexOf(value interface{}) int{
} }
return -1 return -1
} }
// Empty returns true if list does not contain any elements. // Empty returns true if list does not contain any elements.
func (list *List) Empty() bool { func (list *List) Empty() bool {
return list.size == 0 return list.size == 0

@ -137,26 +137,26 @@ func TestListIndexOf(t *testing.T) {
list := New() list := New()
expectedIndex := -1 expectedIndex := -1
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
list.Add("a") list.Add("a")
list.Add("b", "c") list.Add("b", "c")
expectedIndex = 0 expectedIndex = 0
if index := list.IndexOf("a"); index != expectedIndex{ if index := list.IndexOf("a"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 1 expectedIndex = 1
if index := list.IndexOf("b"); index != expectedIndex{ if index := list.IndexOf("b"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
expectedIndex = 2 expectedIndex = 2
if index := list.IndexOf("c"); index != expectedIndex{ if index := list.IndexOf("c"); index != expectedIndex {
t.Errorf("Got %v expected %v",index,expectedIndex) t.Errorf("Got %v expected %v", index, expectedIndex)
} }
} }

Loading…
Cancel
Save