Commit 5eeb3318e23f80e97b5a32ea49d43cbd9fa8560e
fixed tests
wanderer committed on 7/11/2016, 1:57:49 PMFiles changed
.gitmodules | added |
sexpr-wasm-prototype | added |
tests/address.json | added |
tests/address.wast | added |
tests/balance.json | added |
tests/balance.wast | added |
tests/basic_gas_ops.json | added |
tests/basic_gas_ops.wast | added |
tests/callDataSize.json | added |
tests/callDataSize.wast | added |
tests/callValue.json | added |
tests/callValue.wast | added |
tests/caller.json | added |
tests/caller.wast | added |
tests/default_enviroment.json | added |
tests/origin.json | added |
tests/origin.wast | added |
.gitmodules | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +[submodule "sexpr-wasm-prototype"] | |
2 | + path = sexpr-wasm-prototype | |
3 | + url = https://github.com/WebAssembly/sexpr-wasm-prototype.git |
sexpr-wasm-prototype | ||
---|---|---|
@@ -1,0 +1,1 @@ | ||
1 | +Subproject commit b487574ba29dd85c64be6aa1406b58084b14b8b4 |
tests/address.json | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +{ | |
2 | + "address": [93,72,193,1,137,4,161,114,136,104,41,187,189,156,111,74,45,6,196,123] | |
3 | +} |
tests/address.wast | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 | +;; starts with an address of 5d48c1018904a172886829bbbd9c6f4a2d06c47b | |
2 | +(module | |
3 | + (memory 1) | |
4 | + | |
5 | + (import $address "ethereum" "address" (param i32)) | |
6 | + (export "test" 0) | |
7 | + (export "a" memory) | |
8 | + (func | |
9 | + (block | |
10 | + ;; loads the address into memory | |
11 | + (call_import $address (i32.const 0)) | |
12 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 0x72a1048901c1485d)) ;; big enden | |
13 | + (return) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + ) | |
18 | +) |
tests/balance.json | ||
---|---|---|
@@ -1,0 +1,9 @@ | ||
1 | +{ | |
2 | + "accounts": [ | |
3 | + [ | |
4 | + [93, 72, 193, 1, 137, 4, 161, 114, 136, 104, 41, 187, 189, 156, 111, 74, 45, 6, 196, 123], { | |
5 | + "balance": [100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | |
6 | + } | |
7 | + ] | |
8 | + ] | |
9 | +} |
tests/balance.wast | ||
---|---|---|
@@ -1,0 +1,19 @@ | ||
1 | +;; address of 5d48c1018904a172886829bbbd9c6f4a2d06c47b has a balance of 100 | |
2 | +(module | |
3 | + (memory 1 (segment 0 "\5d\48\c1\01\89\04\a1\72\88\68\29\bb\bd\9c\6f\4a\2d\06\c4\7b")) | |
4 | + (import $balance "ethereum" "balance" (param i32 i32)) | |
5 | + (export "a" memory) | |
6 | + (export "test" 0) | |
7 | + (func | |
8 | + (block | |
9 | + (call_import $balance (i32.const 0) (i32.const 0)) | |
10 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 100)) | |
11 | + (if (i64.eq (i64.load (i32.const 8)) (i64.const 0)) | |
12 | + (return) | |
13 | + ) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + ) | |
18 | +) | |
19 | + |
tests/basic_gas_ops.wast | ||
---|---|---|
@@ -1,0 +1,40 @@ | ||
1 | +;; starts with 1000 gas | |
2 | +(module | |
3 | + (import $addGas "ethereum" "addGas" (param i32)) | |
4 | + (import $gasUsed "ethereum" "gasUsed" (result i64)) | |
5 | + (import $gasLeft "ethereum" "gasLeft" (result i64)) | |
6 | + | |
7 | + (export "test" 0) | |
8 | + (func | |
9 | + ;; test adding gas | |
10 | + (block | |
11 | + (call_import $addGas (i32.const 1)) | |
12 | + (if (i64.eq (call_import $gasUsed) (i64.const 1)) | |
13 | + (return) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + (block | |
18 | + (call_import $addGas (i32.const 1)) | |
19 | + (if (i64.eq (call_import $gasUsed) (i64.const 2)) | |
20 | + (return) | |
21 | + ) | |
22 | + (unreachable) | |
23 | + ) | |
24 | + ;; should disregard negative values | |
25 | + (block | |
26 | + (call_import $addGas (i32.const -1)) | |
27 | + (if (i64.eq (call_import $gasUsed) (i64.const 2)) | |
28 | + (return) | |
29 | + ) | |
30 | + (unreachable) | |
31 | + ) | |
32 | + ;; gas left | |
33 | + (block | |
34 | + (if (i64.eq (call_import $gasLeft) (i64.const 998)) | |
35 | + (return) | |
36 | + ) | |
37 | + (unreachable) | |
38 | + ) | |
39 | + ) | |
40 | +) |
tests/callDataSize.json | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +{ | |
2 | + "callData": "596f75206172652077616974696e6720666f7220746865207265766f6c7574696f6e3f204c657420697420626521204d79206f776e20626567616e2061206c6f6e672074696d652061676f21205768656e20796f752077696c6c2062652072656164792e2e2e4920776f6ee2809974206d696e6420676f696e6720616c6f6e67207769746820796f7520666f722061207768696c652e20427574207768656e20796f75e280996c6c2073746f702c2049207368616c6c20636f6e74696e7565206f6e206d7920696e73616e6520616e6420747269756d7068616e742077617920746f776172642074686520677265617420616e64207375626c696d6520636f6e7175657374206f6620746865206e6f7468696e6721" | |
3 | +} |
tests/callDataSize.wast | ||
---|---|---|
@@ -1,0 +1,14 @@ | ||
1 | +(module | |
2 | + (memory 1000) | |
3 | + (import $callDataSize "ethereum" "callDataSize" (result i64)) | |
4 | + | |
5 | + (export "test" 0) | |
6 | + (func | |
7 | + (block | |
8 | + (if (i64.eq (call_import $callDataSize) (i64.const 277)) | |
9 | + (return) | |
10 | + ) | |
11 | + (unreachable) | |
12 | + ) | |
13 | + ) | |
14 | +) |
tests/callValue.wast | ||
---|---|---|
@@ -1,0 +1,19 @@ | ||
1 | +;; call value of 100 | |
2 | +(module | |
3 | + (memory 1) | |
4 | + (import $callValue "ethereum" "callValue" (param i32)) | |
5 | + | |
6 | + (export "a" memory) | |
7 | + (export "test" 0) | |
8 | + (func | |
9 | + (block | |
10 | + (call_import $callValue (i32.const 0)) | |
11 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 100)) | |
12 | + (if (i64.eq (i64.load (i32.const 8)) (i64.const 0)) | |
13 | + (return) | |
14 | + ) | |
15 | + ) | |
16 | + (unreachable) | |
17 | + ) | |
18 | + ) | |
19 | +) |
tests/caller.json | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +{ | |
2 | + "caller": [93,72,193,1,137,4,161,114,136,104,41,187,189,156,111,74,45,6,196,123] | |
3 | +} |
tests/caller.wast | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 | +;; starts with an caller of 5d48c1018904a172886829bbbd9c6f4a2d06c47b | |
2 | +(module | |
3 | + (memory 1) | |
4 | + (import $caller "ethereum" "caller" (param i32)) | |
5 | + | |
6 | + (export "test" 0) | |
7 | + (export "a" memory) | |
8 | + (func | |
9 | + (block | |
10 | + ;; loads the caller into memory | |
11 | + (call_import $caller (i32.const 0)) | |
12 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 0x72a1048901c1485d)) | |
13 | + (return) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + ) | |
18 | +) |
tests/default_enviroment.json | ||
---|---|---|
@@ -1,0 +1,15 @@ | ||
1 | +enviroment: { | |
2 | + gasCounter: 0, | |
3 | + gas: 0, | |
4 | + gasPrice: 0, | |
5 | + gasLimit: 0, | |
6 | + address: [], | |
7 | + origin: [], | |
8 | + coinbase: [], | |
9 | + difficulty: [], | |
10 | + caller: [], | |
11 | + callValue: [], | |
12 | + callData: [], | |
13 | + code: [], | |
14 | + logs: [] | |
15 | +} |
tests/origin.json | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 | +{ | |
2 | + "origin": [93,72,193,1,137,4,161,114,136,104,41,187,189,156,111,74,45,6,196,123] | |
3 | +} |
tests/origin.wast | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 | +;; starts with an origin of 5d48c1018904a172886829bbbd9c6f4a2d06c47b | |
2 | +(module | |
3 | + (memory 1) | |
4 | + (import $origin "ethereum" "origin" (param i32)) | |
5 | + | |
6 | + (export "test" 0) | |
7 | + (export "a" memory) | |
8 | + (func | |
9 | + (block | |
10 | + ;; loads the address into memory | |
11 | + (call_import $origin (i32.const 0)) | |
12 | + (if (i64.eq (i64.load (i32.const 0)) (i64.const 0x72a1048901c1485d)) | |
13 | + (return) | |
14 | + ) | |
15 | + (unreachable) | |
16 | + ) | |
17 | + ) | |
18 | +) |
Built with git-ssb-web