Merge pull request #60 from halfrost/code_quality_improvement

optimization code quality level from A to A+
This commit is contained in:
halfrost
2020-08-27 01:07:57 +08:00
committed by YDZ
543 changed files with 2449 additions and 2396 deletions

View File

@@ -50,4 +50,4 @@ func partitionSort(a []Interval, lo, hi int) int {
}
a[i+1], a[hi] = a[hi], a[i+1]
return i + 1
}
}

View File

@@ -19,19 +19,19 @@ func Test_IntervalSlice2Intss(t *testing.T) {
actual := IntervalSlice2Intss(
[]Interval{
Interval{
{
Start: 1,
End: 2,
},
Interval{
{
Start: 3,
End: 4,
},
},
)
expected := [][]int{
[]int{1, 2},
[]int{3, 4},
{1, 2},
{3, 4},
}
ast.Equal(expected, actual)
@@ -40,18 +40,18 @@ func Test_Intss2IntervalSlice(t *testing.T) {
ast := assert.New(t)
expected := []Interval{
Interval{
{
Start: 1,
End: 2,
},
Interval{
{
Start: 3,
End: 4,
},
}
actual := Intss2IntervalSlice([][]int{
[]int{1, 2},
[]int{3, 4},
{1, 2},
{3, 4},
},
)

View File

@@ -26,11 +26,11 @@ func Test_Intss2Points(t *testing.T) {
},
},
[]Point{
Point{X: 1, Y: 0},
Point{X: 2, Y: 0},
Point{X: 3, Y: 0},
Point{X: 4, Y: 0},
Point{X: 5, Y: 0},
{X: 1, Y: 0},
{X: 2, Y: 0},
{X: 3, Y: 0},
{X: 4, Y: 0},
{X: 5, Y: 0},
},
},
}
@@ -54,11 +54,11 @@ func Test_Points2Intss(t *testing.T) {
"测试 [][]int 转换成 []Point ",
args{
[]Point{
Point{X: 1, Y: 0},
Point{X: 2, Y: 0},
Point{X: 3, Y: 0},
Point{X: 4, Y: 0},
Point{X: 5, Y: 0},
{X: 1, Y: 0},
{X: 2, Y: 0},
{X: 3, Y: 0},
{X: 4, Y: 0},
{X: 5, Y: 0},
},
},
[][]int{