Browse Source

Add support for --singletest filter in VM tests.

Add & correct arithmetic VM tests.
cl-refactor
Paweł Bylica 10 years ago
parent
commit
9a025df4e7
  1. 133
      test/libevm/VMTestsFiller/vmArithmeticTestFiller.json
  2. 7
      test/libevm/vm.cpp

133
test/libevm/VMTestsFiller/vmArithmeticTestFiller.json

@ -729,6 +729,41 @@
} }
}, },
"divByZero_2": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"expect" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"storage" : {
"0x" : "0x00"
}
}
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{ [[ 0 ]] (+ (/ 13 0) 7)}",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"div1": { "div1": {
"env" : { "env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -974,6 +1009,34 @@
} }
}, },
"sdivByZero2": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{ [[ 0 ]] (+ (SDIV (- 0 115792089237316195423570985008687907853269984665640564039457584007900129639935) 0) 1) }",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"sdiv0": { "sdiv0": {
"env" : { "env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -1639,6 +1702,34 @@
} }
}, },
"modByZero": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{ [[ 0 ]] (- (% 3 0) 1) }",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"smod0": { "smod0": {
"env" : { "env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -1873,7 +1964,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "100000"
} }
}, },
@ -1912,6 +2003,34 @@
} }
}, },
"smod8_byZero": {
"env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
"currentNumber" : "0",
"currentGasLimit" : "1000000",
"currentDifficulty" : "256",
"currentTimestamp" : "1",
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba"
},
"pre" : {
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{ [[ 0 ]] (- (SMOD (- 0 200) 0) 13)}",
"storage": {}
}
},
"exec" : {
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
"origin" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"caller" : "cd1722f2947def4cf144679da39c4c32bdc35681",
"value" : "1000000000000000000",
"data" : "",
"gasPrice" : "100000000000000",
"gas" : "100000"
}
},
"addmod0": { "addmod0": {
"env" : { "env" : {
"previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",
@ -2006,7 +2125,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },
@ -2104,7 +2223,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },
@ -2132,7 +2251,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },
@ -2546,7 +2665,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },
@ -2574,7 +2693,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },
@ -2602,7 +2721,7 @@
"value" : "1000000000000000000", "value" : "1000000000000000000",
"data" : "", "data" : "",
"gasPrice" : "100000000000000", "gasPrice" : "100000000000000",
"gas" : "10000" "gas" : "1000000"
} }
}, },

7
test/libevm/vm.cpp

@ -300,9 +300,14 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
{ {
for (auto& i: v.get_obj()) for (auto& i: v.get_obj())
{ {
std::cout << " " << i.first << "\n";
mObject& o = i.second.get_obj(); mObject& o = i.second.get_obj();
if (test::Options::get().singleTest && test::Options::get().singleTestName != i.first)
{
o.clear();
continue;
}
std::cout << " " << i.first << "\n";
BOOST_REQUIRE(o.count("env") > 0); BOOST_REQUIRE(o.count("env") > 0);
BOOST_REQUIRE(o.count("pre") > 0); BOOST_REQUIRE(o.count("pre") > 0);
BOOST_REQUIRE(o.count("exec") > 0); BOOST_REQUIRE(o.count("exec") > 0);

Loading…
Cancel
Save