int_test.gno

1.76 Kb ยท 81 lines
 1package expect_test
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/jeronimoalbi/expect"
 7)
 8
 9func TestIntChecker(t *testing.T) {
10	t.Run("to equal", func(t *testing.T) {
11		t.Parallel()
12
13		ctx := expect.NewContext(t)
14		expect.NewIntChecker(ctx, 1).ToEqual(1)
15	})
16
17	t.Run("not to equal", func(t *testing.T) {
18		t.Parallel()
19
20		ctx := expect.NewContext(t)
21		expect.NewIntChecker(ctx, 1).Not().ToEqual(2)
22	})
23
24	t.Run("to be greater than", func(t *testing.T) {
25		t.Parallel()
26
27		ctx := expect.NewContext(t)
28		expect.NewIntChecker(ctx, 2).ToBeGreaterThan(1)
29	})
30
31	t.Run("not to be greater than", func(t *testing.T) {
32		t.Parallel()
33
34		ctx := expect.NewContext(t)
35		expect.NewIntChecker(ctx, 1).Not().ToBeGreaterThan(2)
36	})
37
38	t.Run("to be greater or equal than", func(t *testing.T) {
39		t.Parallel()
40
41		ctx := expect.NewContext(t)
42		expect.NewIntChecker(ctx, 2).ToBeGreaterOrEqualThan(2)
43		expect.NewIntChecker(ctx, 2).ToBeGreaterOrEqualThan(1)
44	})
45
46	t.Run("not to be greater or equal than", func(t *testing.T) {
47		t.Parallel()
48
49		ctx := expect.NewContext(t)
50		expect.NewIntChecker(ctx, 1).Not().ToBeGreaterOrEqualThan(2)
51	})
52
53	t.Run("to be lower than", func(t *testing.T) {
54		t.Parallel()
55
56		ctx := expect.NewContext(t)
57		expect.NewIntChecker(ctx, 1).ToBeLowerThan(2)
58	})
59
60	t.Run("not to be lower than", func(t *testing.T) {
61		t.Parallel()
62
63		ctx := expect.NewContext(t)
64		expect.NewIntChecker(ctx, 1).Not().ToBeLowerThan(1)
65	})
66
67	t.Run("to be lower or equal than", func(t *testing.T) {
68		t.Parallel()
69
70		ctx := expect.NewContext(t)
71		expect.NewIntChecker(ctx, 1).ToBeLowerOrEqualThan(1)
72		expect.NewIntChecker(ctx, 1).ToBeLowerOrEqualThan(2)
73	})
74
75	t.Run("not to be lower or equal than", func(t *testing.T) {
76		t.Parallel()
77
78		ctx := expect.NewContext(t)
79		expect.NewIntChecker(ctx, 2).Not().ToBeLowerOrEqualThan(1)
80	})
81}