diff options
author | Gav Wood <i@gavwood.com> | 2015-03-05 00:35:23 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-03-05 00:35:23 +0800 |
commit | ec3384a23f3711f2a7c95c7ac8d793cbae7228f6 (patch) | |
tree | 47f3f5dbdf67a3930fc3b6bea858af6e2c37aafd | |
parent | 4d0695c3af26ea4a7310d84bc17c2dfc21186da4 (diff) | |
download | dexon-solidity-ec3384a23f3711f2a7c95c7ac8d793cbae7228f6.tar.gz dexon-solidity-ec3384a23f3711f2a7c95c7ac8d793cbae7228f6.tar.zst dexon-solidity-ec3384a23f3711f2a7c95c7ac8d793cbae7228f6.zip |
Add date/time language to solidity.
-rw-r--r-- | SolidityScanner.cpp | 17 | ||||
-rw-r--r-- | blockchain.cpp | 14 |
2 files changed, 24 insertions, 7 deletions
diff --git a/SolidityScanner.cpp b/SolidityScanner.cpp index 2e4e5db0..8d3e5392 100644 --- a/SolidityScanner.cpp +++ b/SolidityScanner.cpp @@ -264,6 +264,23 @@ BOOST_AUTO_TEST_CASE(ether_subdenominations) BOOST_CHECK_EQUAL(scanner.next(), Token::SubEther); } +BOOST_AUTO_TEST_CASE(time_subdenominations) +{ + Scanner scanner(CharStream("seconds minutes hours days weeks years")); + BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::SubSecond); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubMinute); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubHour); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubDay); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubWeek); + BOOST_CHECK_EQUAL(scanner.next(), Token::SubYear); +} + +BOOST_AUTO_TEST_CASE(time_after) +{ + Scanner scanner(CharStream("after 1")); + BOOST_CHECK_EQUAL(scanner.getCurrentToken(), Token::After); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/blockchain.cpp b/blockchain.cpp index ccfd5772..aea2bab0 100644 --- a/blockchain.cpp +++ b/blockchain.cpp @@ -78,8 +78,8 @@ bytes createBlockRLPFromFields(mObject& _tObj) if (_tObj.count("seedHash")) rlpStream << importByteArray(_tObj["seedHash"].get_str()); - if (_tObj.count("mixBytes")) - rlpStream << importByteArray(_tObj["mixBytes"].get_str()); + if (_tObj.count("mixHash")) + rlpStream << importByteArray(_tObj["mixHash"].get_str()); if (_tObj.count("nonce")) rlpStream << importByteArray(_tObj["nonce"].get_str()); @@ -146,7 +146,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) //update genesis block in json file o["genesisBlockHeader"].get_obj()["stateRoot"] = toString(blockFromFields.stateRoot); o["genesisBlockHeader"].get_obj()["nonce"] = toString(blockFromFields.nonce); - o["genesisBlockHeader"].get_obj()["mixBytes"] = toString(blockFromFields.mixBytes); + o["genesisBlockHeader"].get_obj()["mixHash"] = toString(blockFromFields.mixHash); } // create new "genesis" block @@ -276,8 +276,8 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (blObj["blockHeader"].get_obj().count("extraData")) tmp.extraData = importByteArray(blObj["blockHeader"].get_obj()["extraData"].get_str()); - if (blObj["blockHeader"].get_obj().count("mixBytes")) - tmp.mixBytes = h256(blObj["blockHeader"].get_obj()["mixBytes"].get_str()); + if (blObj["blockHeader"].get_obj().count("mixHash")) + tmp.mixHash = h256(blObj["blockHeader"].get_obj()["mixHash"].get_str()); if (blObj["blockHeader"].get_obj().count("seedHash")) tmp.seedHash = h256(blObj["blockHeader"].get_obj()["seedHash"].get_str()); @@ -322,7 +322,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) oBlockHeader["gasUsed"] = toString(current_BlockHeader.gasUsed); oBlockHeader["timestamp"] = toString(current_BlockHeader.timestamp); oBlockHeader["extraData"] = toHex(current_BlockHeader.extraData); - oBlockHeader["mixBytes"] = toString(current_BlockHeader.mixBytes); + oBlockHeader["mixHash"] = toString(current_BlockHeader.mixHash); oBlockHeader["seedHash"] = toString(current_BlockHeader.seedHash); oBlockHeader["nonce"] = toString(current_BlockHeader.nonce); @@ -445,7 +445,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixBytes == blockFromRlp.mixBytes, "mixBytes in given RLP not matching the block mixBytes!"); + BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixHash == blockFromRlp.mixHash, "mixHash in given RLP not matching the block mixHash!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.seedHash == blockFromRlp.seedHash, "transactionsRoot in given RLP not matching the block transactionsRoot!"); BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); |