-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathstrategy_param_test.go
More file actions
50 lines (48 loc) · 878 Bytes
/
strategy_param_test.go
File metadata and controls
50 lines (48 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package hazana
import "testing"
func Test_strategyParameters_intParam(t *testing.T) {
type fields struct {
line string
}
type args struct {
name string
absent int
}
tests := []struct {
name string
fields fields
args args
want int
}{
{"no params",
fields{"method"},
args{"key", -1},
-1,
},
{"one params",
fields{"method key=5"},
args{"key", -1},
5,
},
{"neg param",
fields{"method key=5 max-factor=-1"},
args{"max-factor", 0},
-1,
},
{"no int param",
fields{"method key=5 chord=C#"},
args{"chord", 0},
0,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := strategyParameters{
line: tt.fields.line,
}
if got := c.intParam(tt.args.name, tt.args.absent); got != tt.want {
t.Errorf("strategyParameters.intParam() = %v, want %v", got, tt.want)
}
})
}
}