forked from maksymgaraiev/orwell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xgteql_test.go
32 lines (30 loc) · 1.11 KB
/
xgteql_test.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
package orwell
import (
"testing"
)
func TestApplyXGtEql(t *testing.T) {
t.Run("gtField > gtValue, isField == isValue, ors nil, value not nil", func(t *testing.T) {
r := &xGtEql{gtField: 10, gtValue: 9, eqlField: "test", eqlValue: "test"}
if err := r.Apply("not nil"); err != nil {
t.Error("Expected valid")
}
})
t.Run("gtField > gtValue, isField == isValue, ors nil, value not nil", func(t *testing.T) {
r := &xGtEql{gtField: 10, gtValue: 9, eqlField: "test", eqlValue: "test"}
if err := r.Apply(nil); err == nil {
t.Error("Expected error")
}
})
t.Run("gtField > gtValue, isField == isValue, ors nil, value not nil", func(t *testing.T) {
r := &xGtEql{gtField: 10, gtValue: 10, eqlField: 0, eqlValue: 0}
if err := r.Apply(nil); err != nil {
t.Error("Expected valid because gtField is not greater than igtValue")
}
})
t.Run("gtField > gtValue, isField == isValue, ors nil, value not nil", func(t *testing.T) {
r := &xGtEql{gtField: 10, gtValue: 9, eqlField: 0, eqlValue: 1}
if err := r.Apply(nil); err != nil {
t.Error("Expected valid because isField and isValue are not equal")
}
})
}