Skip to content

Commit 79c4d41

Browse files
committed
Create two-sum-iii-data-structure-design_test.go
1 parent db0b236 commit 79c4d41

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package two_sum_iii_data_structure_design
2+
3+
import "testing"
4+
5+
func TestTwoSum(t1 *testing.T) {
6+
type args struct {
7+
number int
8+
}
9+
tests := []struct {
10+
name string
11+
args args
12+
want bool
13+
}{
14+
{
15+
name: "test case 1",
16+
args: args{
17+
number: 4,
18+
},
19+
want: true,
20+
},
21+
{
22+
name: "test case 2",
23+
args: args{
24+
number: 1,
25+
},
26+
want: false,
27+
},
28+
}
29+
for _, tt := range tests {
30+
t1.Run(tt.name, func(t *testing.T) {
31+
twoSum := Constructor()
32+
twoSum.Add(1)
33+
twoSum.Add(1)
34+
twoSum.Add(3)
35+
if got := twoSum.Find(tt.args.number); got != tt.want {
36+
t.Errorf("TwoSum.Find() = %v, want %v", got, tt.want)
37+
}
38+
})
39+
}
40+
}

0 commit comments

Comments
 (0)