Skip to content

Commit 51e134e

Browse files
committed
PVM tests v0.2: add more load/store tests
1 parent 83596b5 commit 51e134e

19 files changed

+1806
-0
lines changed

pvm/TESTCASES.md

Lines changed: 480 additions & 0 deletions
Large diffs are not rendered by default.

pvm/programs/inst_load_i16.json

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"name": "inst_load_i16",
3+
"initial-regs": [
4+
0,
5+
0,
6+
0,
7+
0,
8+
0,
9+
0,
10+
0,
11+
0,
12+
0,
13+
0,
14+
0,
15+
0,
16+
0
17+
],
18+
"initial-pc": 0,
19+
"initial-page-map": [
20+
{
21+
"address": 131072,
22+
"length": 4096,
23+
"is-writable": true
24+
}
25+
],
26+
"initial-memory": [
27+
{
28+
"address": 131072,
29+
"contents": [
30+
129,
31+
130
32+
]
33+
}
34+
],
35+
"initial-gas": 10000,
36+
"program": [
37+
0,
38+
0,
39+
5,
40+
66,
41+
7,
42+
0,
43+
0,
44+
2,
45+
1
46+
],
47+
"expected-status": "trap",
48+
"expected-regs": [
49+
0,
50+
0,
51+
0,
52+
0,
53+
0,
54+
0,
55+
0,
56+
4294935169,
57+
0,
58+
0,
59+
0,
60+
0,
61+
0
62+
],
63+
"expected-pc": 5,
64+
"expected-memory": [
65+
{
66+
"address": 131072,
67+
"contents": [
68+
129,
69+
130
70+
]
71+
}
72+
],
73+
"expected-gas": 9998
74+
}

pvm/programs/inst_load_i8.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "inst_load_i8",
3+
"initial-regs": [
4+
0,
5+
0,
6+
0,
7+
0,
8+
0,
9+
0,
10+
0,
11+
0,
12+
0,
13+
0,
14+
0,
15+
0,
16+
0
17+
],
18+
"initial-pc": 0,
19+
"initial-page-map": [
20+
{
21+
"address": 131072,
22+
"length": 4096,
23+
"is-writable": true
24+
}
25+
],
26+
"initial-memory": [
27+
{
28+
"address": 131072,
29+
"contents": [
30+
129
31+
]
32+
}
33+
],
34+
"initial-gas": 10000,
35+
"program": [
36+
0,
37+
0,
38+
5,
39+
74,
40+
7,
41+
0,
42+
0,
43+
2,
44+
1
45+
],
46+
"expected-status": "trap",
47+
"expected-regs": [
48+
0,
49+
0,
50+
0,
51+
0,
52+
0,
53+
0,
54+
0,
55+
4294967169,
56+
0,
57+
0,
58+
0,
59+
0,
60+
0
61+
],
62+
"expected-pc": 5,
63+
"expected-memory": [
64+
{
65+
"address": 131072,
66+
"contents": [
67+
129
68+
]
69+
}
70+
],
71+
"expected-gas": 9998
72+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "inst_load_imm_and_jump",
3+
"initial-regs": [
4+
0,
5+
0,
6+
0,
7+
0,
8+
0,
9+
0,
10+
0,
11+
0,
12+
0,
13+
0,
14+
0,
15+
0,
16+
0
17+
],
18+
"initial-pc": 0,
19+
"initial-page-map": [],
20+
"initial-memory": [],
21+
"initial-gas": 10000,
22+
"program": [
23+
0,
24+
0,
25+
12,
26+
6,
27+
39,
28+
210,
29+
4,
30+
6,
31+
0,
32+
4,
33+
8,
34+
239,
35+
190,
36+
173,
37+
222,
38+
97,
39+
0
40+
],
41+
"expected-status": "trap",
42+
"expected-regs": [
43+
0,
44+
0,
45+
0,
46+
0,
47+
0,
48+
0,
49+
0,
50+
1234,
51+
3735928559,
52+
0,
53+
0,
54+
0,
55+
0
56+
],
57+
"expected-pc": 12,
58+
"expected-memory": [],
59+
"expected-gas": 9997
60+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "inst_load_indirect_i16_with_offset",
3+
"initial-regs": [
4+
0,
5+
0,
6+
0,
7+
0,
8+
0,
9+
0,
10+
0,
11+
131072,
12+
0,
13+
0,
14+
0,
15+
0,
16+
0
17+
],
18+
"initial-pc": 0,
19+
"initial-page-map": [
20+
{
21+
"address": 131072,
22+
"length": 4096,
23+
"is-writable": true
24+
}
25+
],
26+
"initial-memory": [
27+
{
28+
"address": 131072,
29+
"contents": [
30+
129,
31+
130,
32+
131,
33+
132
34+
]
35+
}
36+
],
37+
"initial-gas": 10000,
38+
"program": [
39+
0,
40+
0,
41+
3,
42+
33,
43+
120,
44+
1,
45+
1
46+
],
47+
"expected-status": "trap",
48+
"expected-regs": [
49+
0,
50+
0,
51+
0,
52+
0,
53+
0,
54+
0,
55+
0,
56+
131072,
57+
4294935426,
58+
0,
59+
0,
60+
0,
61+
0
62+
],
63+
"expected-pc": 3,
64+
"expected-memory": [
65+
{
66+
"address": 131072,
67+
"contents": [
68+
129,
69+
130,
70+
131,
71+
132
72+
]
73+
}
74+
],
75+
"expected-gas": 9998
76+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "inst_load_indirect_i16_without_offset",
3+
"initial-regs": [
4+
0,
5+
0,
6+
0,
7+
0,
8+
0,
9+
0,
10+
0,
11+
131072,
12+
0,
13+
0,
14+
0,
15+
0,
16+
0
17+
],
18+
"initial-pc": 0,
19+
"initial-page-map": [
20+
{
21+
"address": 131072,
22+
"length": 4096,
23+
"is-writable": true
24+
}
25+
],
26+
"initial-memory": [
27+
{
28+
"address": 131072,
29+
"contents": [
30+
129,
31+
130,
32+
131,
33+
132
34+
]
35+
}
36+
],
37+
"initial-gas": 10000,
38+
"program": [
39+
0,
40+
0,
41+
2,
42+
33,
43+
120,
44+
1
45+
],
46+
"expected-status": "trap",
47+
"expected-regs": [
48+
0,
49+
0,
50+
0,
51+
0,
52+
0,
53+
0,
54+
0,
55+
131072,
56+
4294935169,
57+
0,
58+
0,
59+
0,
60+
0
61+
],
62+
"expected-pc": 2,
63+
"expected-memory": [
64+
{
65+
"address": 131072,
66+
"contents": [
67+
129,
68+
130,
69+
131,
70+
132
71+
]
72+
}
73+
],
74+
"expected-gas": 9998
75+
}

0 commit comments

Comments
 (0)