Skip to content

Commit 2bd6682

Browse files
authored
Merge pull request #421 from aergoio/topic/test-aergocli
test RPC with aergocli
2 parents 96f411c + dc95d5a commit 2bd6682

File tree

3 files changed

+582
-6
lines changed

3 files changed

+582
-6
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
state.var {
2+
name = state.value(),
3+
list = state.array(),
4+
values = state.map()
5+
}
6+
7+
-- value type
8+
9+
function value_set(new_name)
10+
name:set(new_name)
11+
contract.event("value_set", new_name)
12+
end
13+
14+
function value_get()
15+
return name:get()
16+
end
17+
18+
-- map type
19+
20+
function map_set(key, val)
21+
values[key] = val
22+
contract.event("map_set", key, val)
23+
end
24+
25+
function map_get(key)
26+
return values[key]
27+
end
28+
29+
-- array type
30+
31+
function array_append(val)
32+
list:append(val)
33+
contract.event("array_append", val)
34+
end
35+
36+
function array_set(idx, val)
37+
list[idx] = val
38+
contract.event("array_set", idx, val)
39+
end
40+
41+
function array_get(idx)
42+
return list[idx]
43+
end
44+
45+
function array_length()
46+
return list:length()
47+
end
48+
49+
-- write functions
50+
abi.register(value_set, map_set, array_append, array_set)
51+
-- read-only functions
52+
abi.register_view(value_get, map_get, array_get, array_length)

tests/run_tests.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ function set_version() {
100100
echo "now test hardfork version $version"
101101
# get the current block number / height
102102
block_no=$(../bin/aergocli blockchain | jq .height | sed 's/"//g')
103-
# increment 2 numbers
104-
block_no=$((block_no+2))
103+
# increment 3 numbers
104+
block_no=$((block_no+3))
105105
# terminate the server process(es)
106106
stop_nodes
107107
# save the hardfork config on the config file(s)
@@ -150,8 +150,9 @@ echo "creating user account..."
150150

151151
# run the integration tests - version 2
152152
if [ "$short_tests" = true ]; then
153-
check ./test-contract-deploy.sh
153+
check ./test-aergocli.sh
154154
else
155+
check ./test-aergocli.sh
155156
check ./test-gas-deploy.sh
156157
check ./test-gas-op.sh
157158
check ./test-gas-bf.sh
@@ -168,8 +169,9 @@ set_version 3
168169

169170
# run the integration tests - version 3
170171
if [ "$short_tests" = true ]; then
171-
check ./test-contract-deploy.sh
172+
check ./test-aergocli.sh
172173
else
174+
check ./test-aergocli.sh
173175
check ./test-max-call-depth.sh
174176
check ./test-gas-deploy.sh
175177
check ./test-gas-op.sh
@@ -188,8 +190,9 @@ set_version 4
188190

189191
# run the integration tests - version 4
190192
if [ "$short_tests" = true ]; then
191-
check ./test-contract-deploy.sh
193+
check ./test-aergocli.sh
192194
else
195+
check ./test-aergocli.sh
193196
check ./test-max-call-depth.sh
194197
check ./test-gas-deploy.sh
195198
check ./test-gas-op.sh
@@ -210,8 +213,9 @@ set_version 5
210213

211214
# run the integration tests - version 5
212215
if [ "$short_tests" = true ]; then
213-
check ./test-contract-deploy.sh
216+
check ./test-aergocli.sh
214217
else
218+
check ./test-aergocli.sh
215219
check ./test-max-call-depth.sh
216220
check ./test-gas-deploy.sh
217221
check ./test-gas-op.sh

0 commit comments

Comments
 (0)