You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.0 KiB
Go
73 lines
1.0 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func Test_branch(t *testing.T) {
|
|
type args struct {
|
|
a int
|
|
b int
|
|
}
|
|
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want int
|
|
}{
|
|
// TODO: Add test cases.
|
|
{
|
|
name: "a10",
|
|
args: args{a: 10},
|
|
want: 10,
|
|
},
|
|
{
|
|
name: "b10",
|
|
args: args{b: 10},
|
|
want: 20,
|
|
},
|
|
{
|
|
name: "b10",
|
|
args: args{},
|
|
want: 0,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := branch(tt.args.a, tt.args.b); got != tt.want {
|
|
t.Errorf("branch() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestBranch(t *testing.T) {
|
|
type args struct {
|
|
a int
|
|
b int
|
|
}
|
|
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want int
|
|
}{
|
|
// TODO: Add test cases.
|
|
{
|
|
name: "a10",
|
|
args: args{a: 10},
|
|
want: 10,
|
|
},
|
|
{
|
|
name: "b10",
|
|
args: args{b: 10},
|
|
want: 20,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := branch(tt.args.a, tt.args.b); got != tt.want {
|
|
t.Errorf("branch() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|