float_test.gno
1.83 Kb ยท 81 lines
1package expect_test
2
3import (
4 "testing"
5
6 "gno.land/p/jeronimoalbi/expect"
7)
8
9func TestFloatChecker(t *testing.T) {
10 t.Run("to equal", func(t *testing.T) {
11 t.Parallel()
12
13 ctx := expect.NewContext(t)
14 expect.NewFloatChecker(ctx, 1.2).ToEqual(1.2)
15 })
16
17 t.Run("not to equal", func(t *testing.T) {
18 t.Parallel()
19
20 ctx := expect.NewContext(t)
21 expect.NewFloatChecker(ctx, 1.2).Not().ToEqual(3.4)
22 })
23
24 t.Run("to be greater than", func(t *testing.T) {
25 t.Parallel()
26
27 ctx := expect.NewContext(t)
28 expect.NewFloatChecker(ctx, 1.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.NewFloatChecker(ctx, 1.2).Not().ToBeGreaterThan(1.3)
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.NewFloatChecker(ctx, 1.2).ToBeGreaterOrEqualThan(1.2)
43 expect.NewFloatChecker(ctx, 1.2).ToBeGreaterOrEqualThan(1.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.NewFloatChecker(ctx, 1.2).Not().ToBeGreaterOrEqualThan(1.3)
51 })
52
53 t.Run("to be lower than", func(t *testing.T) {
54 t.Parallel()
55
56 ctx := expect.NewContext(t)
57 expect.NewFloatChecker(ctx, 1.2).ToBeLowerThan(1.3)
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.NewFloatChecker(ctx, 1.2).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.NewFloatChecker(ctx, 1.2).ToBeLowerOrEqualThan(1.2)
72 expect.NewFloatChecker(ctx, 1.2).ToBeLowerOrEqualThan(1.3)
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.NewFloatChecker(ctx, 1.2).Not().ToBeLowerOrEqualThan(1.1)
80 })
81}