1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

fix: fix some spell mistake

This commit is contained in:
dudaodong
2022-02-13 19:00:44 +08:00
parent 8a4c8218d2
commit 48c1f8ffad
5 changed files with 18 additions and 18 deletions

View File

@@ -234,7 +234,7 @@ func (link *DoublyLink[T]) IsEmpty() bool {
return link.length == 0
}
// IsEmpty checks if link is empty or not
// Clear checks if link is empty or not
func (link *DoublyLink[T]) Clear() {
link.Head = nil
link.length = 0

View File

@@ -205,7 +205,7 @@ func (link *SinglyLink[T]) IsEmpty() bool {
return link.length == 0
}
// IsEmpty checks if link is empty or not
// Clear checks if link is empty or not
func (link *SinglyLink[T]) Clear() {
link.Head = nil
link.length = 0

View File

@@ -121,7 +121,7 @@ func (l *List[T]) DeleteAt(index int) {
l.data = data
}
// InsertAt insert value into list at index, index shoud between 0 and list size -1
// UpdateAt update value of list at index, index shoud between 0 and list size -1
func (l *List[T]) UpdateAt(index int, value T) {
data := l.data
size := len(data)
@@ -132,8 +132,8 @@ func (l *List[T]) UpdateAt(index int, value T) {
l.data = append(data[:index], append([]T{value}, data[index+1:]...)...)
}
// EqutalTo compare list to other list, use reflect.DeepEqual
func (l *List[T]) EqutalTo(other *List[T]) bool {
// Equtal compare list to other list, use reflect.DeepEqual
func (l *List[T]) Equtal(other *List[T]) bool {
if len(l.data) != len(other.data) {
return false
}

View File

@@ -155,15 +155,15 @@ func TestUpdateAt(t *testing.T) {
assert.Equal([]int{5, 2, 3, 1}, list.Data())
}
func TestEqutalTo(t *testing.T) {
assert := internal.NewAssert(t, "TestEqutalTo")
func TestEqutal(t *testing.T) {
assert := internal.NewAssert(t, "TestEqutal")
list1 := NewList([]int{1, 2, 3, 4})
list2 := NewList([]int{1, 2, 3, 4})
list3 := NewList([]int{1, 2, 3})
assert.Equal(true, list1.EqutalTo(list2))
assert.Equal(false, list1.EqutalTo(list3))
assert.Equal(true, list1.Equtal(list2))
assert.Equal(false, list1.Equtal(list3))
}
func TestIsEmpty(t *testing.T) {
@@ -192,7 +192,7 @@ func TestClone(t *testing.T) {
list1 := NewList([]int{1, 2, 3, 4})
list2 := list1.Clone()
assert.Equal(true, list1.EqutalTo(list2))
assert.Equal(true, list1.Equtal(list2))
}
func TestMerge(t *testing.T) {
@@ -203,7 +203,7 @@ func TestMerge(t *testing.T) {
expected := NewList([]int{1, 2, 3, 4, 4, 5, 6})
list3 := list1.Merge(list2)
assert.Equal(true, expected.EqutalTo(list3))
assert.Equal(true, expected.Equtal(list3))
}
func TestSize(t *testing.T) {
@@ -224,7 +224,7 @@ func TestSwap(t *testing.T) {
list.Swap(0, 3)
assert.Equal(true, expected.EqutalTo(list))
assert.Equal(true, expected.Equtal(list))
}
func TestReverse(t *testing.T) {
@@ -235,7 +235,7 @@ func TestReverse(t *testing.T) {
list.Reverse()
assert.Equal(true, expected.EqutalTo(list))
assert.Equal(true, expected.Equtal(list))
}
func TestUnique(t *testing.T) {
@@ -246,7 +246,7 @@ func TestUnique(t *testing.T) {
list.Unique()
assert.Equal(true, expected.EqutalTo(list))
assert.Equal(true, expected.Equtal(list))
}
func TestUnion(t *testing.T) {
@@ -257,7 +257,7 @@ func TestUnion(t *testing.T) {
expected := NewList([]int{1, 2, 3, 4, 5, 6})
list3 := list1.Union(list2)
assert.Equal(true, expected.EqutalTo(list3))
assert.Equal(true, expected.Equtal(list3))
}
func TestIntersection(t *testing.T) {
@@ -268,5 +268,5 @@ func TestIntersection(t *testing.T) {
expected := NewList([]int{4})
list3 := list1.Intersection(list2)
assert.Equal(true, expected.EqutalTo(list3))
assert.Equal(true, expected.Equtal(list3))
}

View File

@@ -92,8 +92,8 @@ func (q *LinkedQueue[T]) Clear() {
}
// Print all nodes info of queue link
func (s *LinkedQueue[T]) Print() {
current := s.head
func (q *LinkedQueue[T]) Print() {
current := q.head
info := "[ "
for current != nil {
info += fmt.Sprintf("%+v, ", current)