Browse Source

Added stSystemOperationsTest

cl-refactor
Christoph Jentzsch 10 years ago
parent
commit
76fff57527
  1. 3
      libevm/VM.h
  2. 2
      test/TestHelper.cpp
  3. 1266
      test/stSystemOperationsTestFiller.json
  4. 8
      test/state.cpp
  5. 8
      test/tmpFiller.json

3
libevm/VM.h

@ -104,7 +104,7 @@ template <class Ext> dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con
{ {
int in = _ext.code[i] - (unsigned)Instruction::PUSH1 + 1; int in = _ext.code[i] - (unsigned)Instruction::PUSH1 + 1;
u256 p = 0; u256 p = 0;
for (; in--; i++) for (i++; in--; i++)
p = (p << 8) | _ext.getCode(i); p = (p << 8) | _ext.getCode(i);
if ((_ext.getCode(i) == (byte)Instruction::JUMP || _ext.getCode(i) == (byte)Instruction::JUMPI) && !(_ext.getCode(p) == (byte)Instruction::JUMP || _ext.getCode(p) == (byte)Instruction::JUMPI)) if ((_ext.getCode(i) == (byte)Instruction::JUMP || _ext.getCode(i) == (byte)Instruction::JUMPI) && !(_ext.getCode(p) == (byte)Instruction::JUMP || _ext.getCode(p) == (byte)Instruction::JUMPI))
if (p >= _ext.code.size()) if (p >= _ext.code.size())
@ -112,6 +112,7 @@ template <class Ext> dev::bytesConstRef dev::eth::VM::go(Ext& _ext, OnOpFunc con
else else
implicit.insert(p); implicit.insert(p);
else {} else {}
i--;
} }
for (unsigned i = 0; i < _ext.code.size(); i += instructionInfo((Instruction)_ext.getCode(i)).additional + 1) for (unsigned i = 0; i < _ext.code.size(); i += instructionInfo((Instruction)_ext.getCode(i)).additional + 1)
if (implicit.count(i)) if (implicit.count(i))

2
test/TestHelper.cpp

@ -27,7 +27,7 @@
#include <libethereum/Client.h> #include <libethereum/Client.h>
#include <liblll/Compiler.h> #include <liblll/Compiler.h>
//#define FILL_TESTS #define FILL_TESTS
using namespace std; using namespace std;
using namespace dev::eth; using namespace dev::eth;

1266
test/stSystemOperationsTestFiller.json

File diff suppressed because it is too large

8
test/state.cpp

@ -121,10 +121,10 @@ BOOST_AUTO_TEST_CASE(stExample)
dev::test::executeTests("stExample", "/StateTests", dev::test::doStateTests); dev::test::executeTests("stExample", "/StateTests", dev::test::doStateTests);
} }
//BOOST_AUTO_TEST_CASE(stSystemOperationsTest) BOOST_AUTO_TEST_CASE(stSystemOperationsTest)
//{ {
// dev::test::executeStateTests("stSystemOperationsTest"); dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests);
//} }
BOOST_AUTO_TEST_CASE(tmp) BOOST_AUTO_TEST_CASE(tmp)
{ {

8
test/tmpFiller.json

@ -1,5 +1,5 @@
{ {
"ABAcalls0": { "CallToReturn1": {
"env" : { "env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0", "currentNumber" : "0",
@ -12,12 +12,12 @@
"095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
"balance" : "1000000000000000000", "balance" : "1000000000000000000",
"nonce" : 0, "nonce" : 0,
"code" : "{ [[ (PC) ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 24 0 0 0 0) }", "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2) }",
"storage": {} "storage": {}
}, },
"945304eb96065b2a98b57a48a06ae28d285a71b5" : { "945304eb96065b2a98b57a48a06ae28d285a71b5" : {
"balance" : "23", "balance" : "23",
"code" : " { [[ (PC) ]] (ADD 1 (CALL 500 0x095e7baea6a6c7c4c2dfeb977efac326af552d87 23 0 0 0 0)) } ", "code" : "0x6001600153603760005360026000f2",
"nonce" : "0", "nonce" : "0",
"storage" : { "storage" : {
} }
@ -39,6 +39,4 @@
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"data" : "" "data" : ""
} }
}
} }

Loading…
Cancel
Save