Skip to content

Commit

Permalink
Rm/add static check (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
spring1843 committed Jul 13, 2023
1 parent 2c282a8 commit 4869416
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
issues:
include:
- EXC0001
- EXC0002
- EXC0003
- EXC0004
- EXC0005
- EXC0006
- EXC0007
- EXC0008
- EXC0009
- EXC0010
- EXC0011
- EXC0012
- EXC0013
- EXC0014
exclude-rules:
- path: /
linters:
Expand All @@ -20,3 +35,6 @@ issues:

linters:
enable-all: true
enable:
- revive
- misspell
4 changes: 2 additions & 2 deletions heap/heap_sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type (
}
)

// HeapSort solves the problem in O(n*Log n) time and O(n) space.
func HeapSort(list []int) []int {
// Sort solves the problem in O(n*Log n) time and O(n) space.
func Sort(list []int) []int {
sorted := []int{}
heap := NewMinHeap()
for _, val := range list {
Expand Down
6 changes: 3 additions & 3 deletions heap/heap_sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
)

/*
TestHeapSort tests solution(s) with the following signature and problem description:
TestSort tests solution(s) with the following signature and problem description:
func HeapSort(list []int) []int
Given a list of integers like {3,1,2}, return a sorted set like {1,2,3} using Heap Sort.
*/
func TestHeapSort(t *testing.T) {
func TestSort(t *testing.T) {
tests := []struct {
list []int
sorted []int
Expand All @@ -28,7 +28,7 @@ func TestHeapSort(t *testing.T) {
}

for i, test := range tests {
if got := HeapSort(test.list); !reflect.DeepEqual(got, test.sorted) {
if got := Sort(test.list); !reflect.DeepEqual(got, test.sorted) {
t.Fatalf("Failed test case #%d. Want %v got %v", i, test.sorted, got)
}
}
Expand Down

0 comments on commit 4869416

Please sign in to comment.