Browse Source

Move old VM arithmetic tests from EVM JIT to JSON file

cl-refactor
Paweł Bylica 10 years ago
parent
commit
0989a7d09a
  1. 1
      evmjit/evmcc/test/arith/addmod.evm
  2. 12
      evmjit/evmcc/test/arith/addmod.lll
  3. 1
      evmjit/evmcc/test/arith/arith1.evm
  4. 37
      evmjit/evmcc/test/arith/arith1.lll
  5. 1
      evmjit/evmcc/test/arith/arith_bnot.evm
  6. 14
      evmjit/evmcc/test/arith/arith_bnot.lll
  7. 1
      evmjit/evmcc/test/arith/div.evm
  8. 10
      evmjit/evmcc/test/arith/div.lll
  9. 1
      evmjit/evmcc/test/arith/fib1.evm
  10. 57
      evmjit/evmcc/test/arith/fib1.lll
  11. 1
      evmjit/evmcc/test/arith/mul.evm
  12. 13
      evmjit/evmcc/test/arith/mul.lll
  13. 1
      evmjit/evmcc/test/arith/mulmod.evm
  14. 12
      evmjit/evmcc/test/arith/mulmod.lll
  15. 1
      evmjit/evmcc/test/except/badinst1.evm
  16. 167
      test/vmArithmeticTestFiller.json

1
evmjit/evmcc/test/arith/addmod.evm

@ -1 +0,0 @@
60646107b760271460005560006001f2

12
evmjit/evmcc/test/arith/addmod.lll

@ -1,12 +0,0 @@
;; Should return (1975 + 39) `mod` 100 = 14 = 0x0e
(asm
100
1975
39
ADDMOD
0
MSTORE8
0
1
RETURN
)

1
evmjit/evmcc/test/arith/arith1.evm

@ -1 +0,0 @@
60016001900160070260050160029004600490066021900560150160030260059007600303600960110860005460086000f2

37
evmjit/evmcc/test/arith/arith1.lll

@ -1,37 +0,0 @@
(asm
1
1
SWAP1
ADD ;; 2
7
MUL ;; 14
5
ADD ;; 19
2
SWAP1
DIV ;; 9
4
SWAP1
MOD ;; 1
33
SWAP1
SDIV;; 0
21
ADD ;; 21
3
MUL ;; 63
5
SWAP1
SMOD;; 3
3
SUB ;; 0
9
17
EXP ;; 17^9
0
MSTORE
8
0
RETURN
)

1
evmjit/evmcc/test/arith/arith_bnot.evm

@ -1 +0,0 @@
6201e2406000546000530960005460206000f2

14
evmjit/evmcc/test/arith/arith_bnot.lll

@ -1,14 +0,0 @@
(asm
123456
0
MSTORE
0
MLOAD
BNOT
0
MSTORE
32
0
RETURN
)

1
evmjit/evmcc/test/arith/div.evm

@ -1 +0,0 @@
60027ffedcba9876543210fedcba9876543210fedcba9876543210fedcba98765432100460005460206000f2

10
evmjit/evmcc/test/arith/div.lll

@ -1,10 +0,0 @@
(asm
0x2
0xfedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
DIV
0
MSTORE
32
0
RETURN
)

1
evmjit/evmcc/test/arith/fib1.evm

@ -1 +0,0 @@
60016001818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101

57
evmjit/evmcc/test/arith/fib1.lll

@ -1,57 +0,0 @@
;; Fibbonacci unrolled
(asm
1
1
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
DUP2
DUP2
ADD
)

1
evmjit/evmcc/test/arith/mul.evm

@ -1 +0,0 @@
7001234567890abcdef0fedcba09876543217001234567890abcdef0fedcba09876543217001234567890abcdef0fedcba0987654321020260005460206000f2

13
evmjit/evmcc/test/arith/mul.lll

@ -1,13 +0,0 @@
(asm
0x1234567890abcdef0fedcba0987654321
0x1234567890abcdef0fedcba0987654321
0x1234567890abcdef0fedcba0987654321
MUL
MUL
0
MSTORE
32
0
RETURN
;; 47d0817e4167b1eb4f9fc722b133ef9d7d9a6fb4c2c1c442d000107a5e419561
)

1
evmjit/evmcc/test/arith/mulmod.evm

@ -1 +0,0 @@
6064601b60251560005560006001f2

12
evmjit/evmcc/test/arith/mulmod.lll

@ -1,12 +0,0 @@
;; Should return (27 * 37) `mod` 100 = 99 = 0x63
(asm
100
27
37
MULMOD
0
MSTORE8
0
1
RETURN
)

1
evmjit/evmcc/test/except/badinst1.evm

@ -1 +0,0 @@
4a

167
test/vmArithmeticTestFiller.json

@ -365,6 +365,33 @@
}
},
"mul7": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 0x1234567890abcdef0fedcba0987654321 0x1234567890abcdef0fedcba0987654321 0x1234567890abcdef0fedcba0987654321 MUL MUL 0 MSTORE 32 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"sub0": {
"env" : {
@ -534,6 +561,34 @@
}
},
"div1": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 0x2 0xfedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210 DIV 0 MSTORE 32 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"divByNonZero0": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -1627,6 +1682,34 @@
}
},
"mulmod4": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 100 27 37 MULMOD 0 MSTORE8 0 1 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"mulmoddivByZero": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -4370,5 +4453,89 @@
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"not1": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 123456 0 MSTORE 0 MLOAD NOT 0 MSTORE 32 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"arith1": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 1 1 SWAP1 ADD 7 MUL 5 ADD 2 SWAP1 DIV 4 SWAP1 1 33 SWAP1 SDIV 21 ADD 3 MUL 5 SWAP1 SMOD 3 SUB 9 17 EXP 0 MSTORE 8 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
},
"fibbonacci_unrolled": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "(asm 1 1 DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD DUP2 DUP2 ADD 0 MSTORE 32 0 RETURN)",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "10000"
}
}
}

Loading…
Cancel
Save