Skip to content

Commit 56ebca6

Browse files
author
Shuo
authoredNov 15, 2019
Merge pull request #712 from openset/develop
Update: test
2 parents 5bb90bd + 963ebd2 commit 56ebca6

File tree

219 files changed

+3575
-3575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+3575
-3575
lines changed
 

‎internal/leetcode/question_data.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -332,22 +332,22 @@ const testTpl = `package {{packageName}}
332332
333333
import "testing"
334334
335-
type caseType struct {
336-
input int
337-
expected int
335+
type testType struct {
336+
in int
337+
want int
338338
}
339339
340340
func Test{{funcName}}(t *testing.T) {
341-
tests := [...]caseType{
341+
tests := [...]testType{
342342
{
343-
input: 0,
344-
expected: 0,
343+
in: 0,
344+
want: 0,
345345
},
346346
}
347-
for _, tc := range tests {
348-
output := 0
349-
if output != tc.expected {
350-
t.Fatalf("input: %v, output: %v, expected: %v", tc.input, output, tc.expected)
347+
for _, tt := range tests {
348+
got := 0
349+
if got != tt.want {
350+
t.Fatalf("in: %v, got: %v, want: %v", tt.in, got, tt.want)
351351
}
352352
}
353353
}

‎problems/01-matrix/01_matrix_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@ import (
55
"testing"
66
)
77

8-
type caseType struct {
9-
input [][]int
10-
expected [][]int
8+
type testType struct {
9+
in [][]int
10+
want [][]int
1111
}
1212

1313
func TestUpdateMatrix(t *testing.T) {
14-
tests := [...]caseType{
14+
tests := [...]testType{
1515
{
16-
input: [][]int{
16+
in: [][]int{
1717
{0, 0, 0},
1818
{0, 1, 0},
1919
{0, 0, 0},
2020
},
21-
expected: [][]int{
21+
want: [][]int{
2222
{0, 0, 0},
2323
{0, 1, 0},
2424
{0, 0, 0},
2525
},
2626
},
2727
{
28-
input: [][]int{
28+
in: [][]int{
2929
{0, 0, 0},
3030
{0, 1, 0},
3131
{1, 1, 1},
3232
},
33-
expected: [][]int{
33+
want: [][]int{
3434
{0, 0, 0},
3535
{0, 1, 0},
3636
{1, 2, 1},
3737
},
3838
},
3939
}
40-
for _, tc := range tests {
41-
output := updateMatrix(tc.input)
42-
if !reflect.DeepEqual(output, tc.expected) {
43-
t.Fatalf("input: %v, output: %v, expected: %v", tc.input, output, tc.expected)
40+
for _, tt := range tests {
41+
got := updateMatrix(tt.in)
42+
if !reflect.DeepEqual(got, tt.want) {
43+
t.Fatalf("in: %v, got: %v, want: %v", tt.in, got, tt.want)
4444
}
4545
}
4646
}

0 commit comments

Comments
 (0)