From d1a8f37a71275df7b7525c92ef63f9ba6e1984b3 Mon Sep 17 00:00:00 2001 From: feng6917 <82997695+feng6917@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:15:23 +0800 Subject: [PATCH] Correction of word assert spelling mistakes (#269) --- algorithm/lrucache_test.go | 16 ++++++++-------- algorithm/search_test.go | 18 +++++++++--------- algorithm/sort_test.go | 36 ++++++++++++++++++------------------ 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/algorithm/lrucache_test.go b/algorithm/lrucache_test.go index 0b1a5829..61454450 100644 --- a/algorithm/lrucache_test.go +++ b/algorithm/lrucache_test.go @@ -8,7 +8,7 @@ import ( func TestLRUCache(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestLRUCache") + assert := internal.NewAssert(t, "TestLRUCache") cache := NewLRUCache[int, int](3) @@ -16,19 +16,19 @@ func TestLRUCache(t *testing.T) { cache.Put(2, 2) cache.Put(3, 3) - asssert.Equal(3, cache.Len()) + assert.Equal(3, cache.Len()) v, ok := cache.Get(1) - asssert.Equal(true, ok) - asssert.Equal(1, v) + assert.Equal(true, ok) + assert.Equal(1, v) v, ok = cache.Get(2) - asssert.Equal(true, ok) - asssert.Equal(2, v) + assert.Equal(true, ok) + assert.Equal(2, v) ok = cache.Delete(2) - asssert.Equal(true, ok) + assert.Equal(true, ok) _, ok = cache.Get(2) - asssert.Equal(false, ok) + assert.Equal(false, ok) } diff --git a/algorithm/search_test.go b/algorithm/search_test.go index d4586f48..b7665efa 100644 --- a/algorithm/search_test.go +++ b/algorithm/search_test.go @@ -8,34 +8,34 @@ import ( func TestLinearSearch(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestLinearSearch") + assert := internal.NewAssert(t, "TestLinearSearch") numbers := []int{3, 4, 5, 3, 2, 1} equalFunc := func(a, b int) bool { return a == b } - asssert.Equal(0, LinearSearch(numbers, 3, equalFunc)) - asssert.Equal(-1, LinearSearch(numbers, 6, equalFunc)) + assert.Equal(0, LinearSearch(numbers, 3, equalFunc)) + assert.Equal(-1, LinearSearch(numbers, 6, equalFunc)) } func TestBinarySearch(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestBinarySearch") + assert := internal.NewAssert(t, "TestBinarySearch") sortedNumbers := []int{1, 2, 3, 4, 5, 6, 7, 8} comparator := &intComparator{} - asssert.Equal(4, BinarySearch(sortedNumbers, 5, 0, len(sortedNumbers)-1, comparator)) - asssert.Equal(-1, BinarySearch(sortedNumbers, 9, 0, len(sortedNumbers)-1, comparator)) + assert.Equal(4, BinarySearch(sortedNumbers, 5, 0, len(sortedNumbers)-1, comparator)) + assert.Equal(-1, BinarySearch(sortedNumbers, 9, 0, len(sortedNumbers)-1, comparator)) } func TestBinaryIterativeSearch(t *testing.T) { - asssert := internal.NewAssert(t, "TestBinaryIterativeSearch") + assert := internal.NewAssert(t, "TestBinaryIterativeSearch") sortedNumbers := []int{1, 2, 3, 4, 5, 6, 7, 8} comparator := &intComparator{} - asssert.Equal(4, BinaryIterativeSearch(sortedNumbers, 5, 0, len(sortedNumbers)-1, comparator)) - asssert.Equal(-1, BinaryIterativeSearch(sortedNumbers, 9, 0, len(sortedNumbers)-1, comparator)) + assert.Equal(4, BinaryIterativeSearch(sortedNumbers, 5, 0, len(sortedNumbers)-1, comparator)) + assert.Equal(-1, BinaryIterativeSearch(sortedNumbers, 9, 0, len(sortedNumbers)-1, comparator)) } diff --git a/algorithm/sort_test.go b/algorithm/sort_test.go index d514aa37..e96a5e68 100644 --- a/algorithm/sort_test.go +++ b/algorithm/sort_test.go @@ -47,7 +47,7 @@ func (c *intComparator) Compare(v1 any, v2 any) int { func TestBubbleSortForStructSlice(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestBubbleSortForStructSlice") + assert := internal.NewAssert(t, "TestBubbleSortForStructSlice") peoples := []people{ {Name: "a", Age: 20}, @@ -62,23 +62,23 @@ func TestBubbleSortForStructSlice(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestBubbleSortForIntSlice(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestBubbleSortForIntSlice") + assert := internal.NewAssert(t, "TestBubbleSortForIntSlice") numbers := []int{2, 1, 5, 3, 6, 4} comparator := &intComparator{} BubbleSort(numbers, comparator) - asssert.Equal([]int{1, 2, 3, 4, 5, 6}, numbers) + assert.Equal([]int{1, 2, 3, 4, 5, 6}, numbers) } func TestInsertionSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestInsertionSort") + assert := internal.NewAssert(t, "TestInsertionSort") peoples := []people{ {Name: "a", Age: 20}, @@ -93,12 +93,12 @@ func TestInsertionSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestSelectionSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestSelectionSort") + assert := internal.NewAssert(t, "TestSelectionSort") peoples := []people{ {Name: "a", Age: 20}, @@ -113,12 +113,12 @@ func TestSelectionSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestShellSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestShellSort") + assert := internal.NewAssert(t, "TestShellSort") peoples := []people{ {Name: "a", Age: 20}, @@ -133,12 +133,12 @@ func TestShellSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestQuickSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestQuickSort") + assert := internal.NewAssert(t, "TestQuickSort") peoples := []people{ {Name: "a", Age: 20}, @@ -153,12 +153,12 @@ func TestQuickSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestHeapSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestHeapSort") + assert := internal.NewAssert(t, "TestHeapSort") peoples := []people{ {Name: "a", Age: 20}, @@ -173,12 +173,12 @@ func TestHeapSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestMergeSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestMergeSort") + assert := internal.NewAssert(t, "TestMergeSort") peoples := []people{ {Name: "a", Age: 20}, @@ -193,12 +193,12 @@ func TestMergeSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", peoples) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) } func TestCountSort(t *testing.T) { t.Parallel() - asssert := internal.NewAssert(t, "TestCountSort") + assert := internal.NewAssert(t, "TestCountSort") peoples := []people{ {Name: "a", Age: 20}, @@ -213,5 +213,5 @@ func TestCountSort(t *testing.T) { expected := "[{d 8} {b 10} {c 17} {a 20} {e 28}]" actual := fmt.Sprintf("%v", sortedPeopleByAge) - asssert.Equal(expected, actual) + assert.Equal(expected, actual) }