diff options
author | Gav Wood <g@ethdev.com> | 2015-04-09 04:42:36 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-04-09 04:42:36 +0800 |
commit | 07940a644dc561a5388b42a528f96095de1c510b (patch) | |
tree | 64ea178c34965df6357b362fa46a046ed3e78b44 /TestHelper.h | |
parent | 377e5435580e2e7e948e4a7690f0249f6af032d9 (diff) | |
parent | ff5ce7bda3346e3893d933196371564b4e45baec (diff) | |
download | dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar.gz dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar.bz2 dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar.lz dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar.xz dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.tar.zst dexon-solidity-07940a644dc561a5388b42a528f96095de1c510b.zip |
Merge pull request #1401 from winsvega/expectedState
Expected state
Diffstat (limited to 'TestHelper.h')
-rw-r--r-- | TestHelper.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/TestHelper.h b/TestHelper.h index 7f6d7336..04ca95be 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -97,6 +97,16 @@ namespace test } \ while (0) +struct ImportStateOptions +{ + ImportStateOptions(bool _bSetAll = false):m_bHasBalance(_bSetAll), m_bHasNonce(_bSetAll), m_bHasCode(_bSetAll), m_bHasStorage(_bSetAll) {} + bool isAllSet() {return m_bHasBalance && m_bHasNonce && m_bHasCode && m_bHasStorage;} + bool m_bHasBalance; + bool m_bHasNonce; + bool m_bHasCode; + bool m_bHasStorage; +}; +typedef std::map<Address, ImportStateOptions> stateOptionsMap; class ImportTest { @@ -105,9 +115,12 @@ public: ImportTest(json_spirit::mObject& _o, bool isFiller); // imports void importEnv(json_spirit::mObject& _o); - void importState(json_spirit::mObject& _o, eth::State& _state); + static void importState(json_spirit::mObject& _o, eth::State& _state); + static void importState(json_spirit::mObject& _o, eth::State& _state, stateOptionsMap& _stateOptionsMap); void importTransaction(json_spirit::mObject& _o); + void exportTest(bytes const& _output, eth::State const& _statePost); + static void checkExpectedState(eth::State const& _stateExpect, eth::State const& _statePost, stateOptionsMap const _expectedStateOptions = stateOptionsMap(), WhenError _throw = WhenError::Throw); eth::State m_statePre; eth::State m_statePost; @@ -165,6 +178,7 @@ public: bool fillTests = false; ///< Create JSON test files from execution results bool stats = false; ///< Execution time stats std::string statsOutFile; ///< Stats output file. "out" for standard output + bool checkState = false;///< Throw error when checking test states /// Test selection /// @{ |