Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2e6d89f

Browse files
Create find-original-array-from-doubled-array_test.go
1 parent 3d119f4 commit 2e6d89f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package leetcode_solutions_golang
2+
3+
import (
4+
"reflect"
5+
"testing"
6+
)
7+
8+
func Test_findOriginalArray(t *testing.T) {
9+
type args struct {
10+
changed []int
11+
}
12+
tests := []struct {
13+
name string
14+
args args
15+
want []int
16+
}{
17+
{
18+
name: "test case 1",
19+
args: args{
20+
changed: []int{1, 3, 4, 2, 6, 8},
21+
},
22+
want: []int{4, 3, 1},
23+
},
24+
{
25+
name: "test case 2",
26+
args: args{
27+
changed: []int{6, 3, 0, 1},
28+
},
29+
want: []int{},
30+
},
31+
{
32+
name: "test case 3",
33+
args: args{
34+
changed: []int{1},
35+
},
36+
want: []int{},
37+
},
38+
}
39+
for _, tt := range tests {
40+
t.Run(tt.name, func(t *testing.T) {
41+
if got := findOriginalArray(tt.args.changed); !reflect.DeepEqual(got, tt.want) {
42+
t.Errorf("findOriginalArray() = %v, want %v", got, tt.want)
43+
}
44+
})
45+
}
46+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /