@@ -39,102 +39,18 @@ func TestGetDecimals(t *testing.T) {
39
39
uassert.Equal(t, uint(6), GetDecimals())
40
40
}
41
41
42
- func TestTotalSupply(t *testing.T) {
43
-
44
- uassert.Equal(t, INITIAL_MINT_AMOUNT, TotalSupply())
45
- }
46
-
47
42
func TestKnownAccounts(t *testing.T) {
48
43
uassert.Equal(t, int(1), KnownAccounts())
49
44
}
50
45
51
- func TestBalanceOfAddress(t *testing.T) {
52
- t.Run(
53
- "should return balance of address",
54
- func(t *testing.T) {
55
- uassert.Equal(t, INITIAL_MINT_AMOUNT, BalanceOfAddress(consts.ADMIN))
56
- },
57
- )
58
- t.Run(
59
- "should panic if address is not valid",
60
- func(t *testing.T) {
61
- uassert.PanicsWithMessage(t, "[GNOSWAP-COMMON-005] invalid address || 0xabcdefg", func() {
62
- BalanceOfAddress("0xabcdefg")
63
- })
64
- },
65
- )
66
- }
67
-
68
- func TestAllowanceOfAddress(t *testing.T) {
69
- t.Run(
70
- "should return allowance of address",
71
- func(t *testing.T) {
72
- uassert.Equal(t, uint64(0), AllowanceOfAddress(consts.ADMIN, alice))
73
-
74
- std.TestSetOrigCaller(consts.ADMIN)
75
- Approve(alice, uint64(123))
76
- uassert.Equal(t, uint64(123), AllowanceOfAddress(consts.ADMIN, alice))
77
- },
78
- )
79
- t.Run(
80
- "should panic if address is not valid",
81
- func(t *testing.T) {
82
- uassert.PanicsWithMessage(t, "[GNOSWAP-COMMON-005] invalid address || 0xabcdefg", func() {
83
- AllowanceOfAddress("0xabcdefg", alice)
84
- })
85
- },
86
- )
87
- t.Run(
88
- "should panic if spender is not valid",
89
- func(t *testing.T) {
90
- uassert.PanicsWithMessage(t, "[GNOSWAP-COMMON-005] invalid address || 0xabcdefg", func() {
91
- AllowanceOfAddress(consts.ADMIN, "0xabcdefg")
92
- })
93
- },
94
- )
46
+ func TestTotalSupply(t *testing.T) {
47
+ uassert.Equal(t, INITIAL_MINT_AMOUNT, TotalSupply())
95
48
}
96
49
97
50
func TestBalanceOf(t *testing.T) {
98
51
uassert.Equal(t, INITIAL_MINT_AMOUNT, BalanceOf(consts.ADMIN))
99
52
}
100
53
101
- func TestSpendAllowance(t *testing.T) {
102
- t.Run(
103
- "should spend allowance",
104
- func(t *testing.T) {
105
- std.TestSetOrigCaller(consts.ADMIN)
106
- Approve(alice, uint64(123))
107
-
108
- SpendAllowance(consts.ADMIN, alice, uint64(23))
109
- uassert.Equal(t, uint64(100), Allowance(consts.ADMIN, alice))
110
- },
111
- )
112
- t.Run(
113
- "should panic if address is not valid",
114
- func(t *testing.T) {
115
- uassert.PanicsWithMessage(t, "invalid address", func() {
116
- SpendAllowance("0xabcdefg", alice, uint64(123))
117
- })
118
- },
119
- )
120
- t.Run(
121
- "should panic if spender is not valid",
122
- func(t *testing.T) {
123
- uassert.PanicsWithMessage(t, "invalid address", func() {
124
- SpendAllowance(consts.ADMIN, "0xabcdefg", uint64(123))
125
- })
126
- },
127
- )
128
- t.Run(
129
- "should panic if allowance is not enough",
130
- func(t *testing.T) {
131
- uassert.PanicsWithMessage(t, "insufficient allowance", func() {
132
- SpendAllowance(consts.ADMIN, alice, uint64(123))
133
- })
134
- },
135
- )
136
- }
137
-
138
54
func TestAssertTooManyEmission(t *testing.T) {
139
55
tests := []struct {
140
56
name string
0 commit comments