-
Notifications
You must be signed in to change notification settings - Fork 2
/
ordered_test.go
75 lines (68 loc) · 1.96 KB
/
ordered_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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package verify_test
import (
"testing"
"github.com/fluentassert/verify"
)
func TestOrdered(t *testing.T) {
t.Run("Lesser", func(t *testing.T) {
t.Run("Lesser", func(t *testing.T) {
msg := verify.Ordered(0).Lesser(1)
assertPassed(t, msg)
})
t.Run("Equal", func(t *testing.T) {
msg := verify.Ordered(0).Lesser(0)
assertFailed(t, msg, "the object is not lesser")
})
t.Run("Greater", func(t *testing.T) {
msg := verify.Ordered(0).Lesser(-1)
assertFailed(t, msg, "the object is not lesser")
})
})
t.Run("LesserOrEqual", func(t *testing.T) {
t.Run("Lesser", func(t *testing.T) {
msg := verify.Ordered(0).LesserOrEqual(1)
assertPassed(t, msg)
})
t.Run("Equal", func(t *testing.T) {
msg := verify.Ordered(0).LesserOrEqual(0)
assertPassed(t, msg)
})
t.Run("Greater", func(t *testing.T) {
msg := verify.Ordered(0).LesserOrEqual(-1)
assertFailed(t, msg, "the object is not lesser or equal")
})
})
t.Run("GreaterOrEqual", func(t *testing.T) {
t.Run("Lesser", func(t *testing.T) {
msg := verify.Ordered(0).GreaterOrEqual(1)
assertFailed(t, msg, "the object is not greater or equal")
})
t.Run("Equal", func(t *testing.T) {
msg := verify.Ordered(0).GreaterOrEqual(0)
assertPassed(t, msg)
})
t.Run("Greater", func(t *testing.T) {
msg := verify.Ordered(0).GreaterOrEqual(-1)
assertPassed(t, msg)
})
})
t.Run("Greater", func(t *testing.T) {
t.Run("Lesser", func(t *testing.T) {
msg := verify.Ordered(0).Greater(1)
assertFailed(t, msg, "the object is not greater")
})
t.Run("Equal", func(t *testing.T) {
msg := verify.Ordered(0).Greater(0)
assertFailed(t, msg, "the object is not greater")
})
t.Run("Greater", func(t *testing.T) {
msg := verify.Ordered(0).Greater(-1)
assertPassed(t, msg)
})
})
t.Run("has assertions from Obj and Any", func(t *testing.T) {
want := 123
got := verify.Ordered(want).FluentObj.FluentAny.Got // type embedding done properly
assertEqual(t, got, want)
})
}