-
Notifications
You must be signed in to change notification settings - Fork 0
/
value_checker.go
51 lines (41 loc) · 939 Bytes
/
value_checker.go
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
51
package workflowmodel
type StringValueChecker interface {
CheckValue(s string) bool
}
type StringEqualValueChecker struct {
ExpectedValue string
}
func (c *StringEqualValueChecker) CheckValue(s string) bool {
return s == c.ExpectedValue
}
type StringInValueChecker struct {
ExpectedValues []string
}
func (c *StringInValueChecker) CheckValue(s string) bool {
for _, v := range c.ExpectedValues {
if s == v {
return true
}
}
return false
}
type NodeStatusValueChecker interface {
CheckValue(status NodeStatus) bool
}
type NodeStatusEqualValueChecker struct {
ExpectedValue NodeStatus
}
func (c *NodeStatusEqualValueChecker) CheckValue(s NodeStatus) bool {
return s == c.ExpectedValue
}
type NodeStatusInValueChecker struct {
ExpectedValues []NodeStatus
}
func (c *NodeStatusInValueChecker) CheckValue(s NodeStatus) bool {
for _, v := range c.ExpectedValues {
if s == v {
return true
}
}
return false
}