aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry <dimitry@ethdev.com>2015-07-28 02:14:55 +0800
committerDimitry <dimitry@ethdev.com>2015-08-12 23:11:32 +0800
commitb12507c55e2ab3cb2d709f998d9229546a345238 (patch)
tree92cff0f6f055aa515b884e737f847db6f815300f
parent80750d746cde4511010fb8984daa0d118bce2f2e (diff)
downloaddexon-solidity-b12507c55e2ab3cb2d709f998d9229546a345238.tar.gz
dexon-solidity-b12507c55e2ab3cb2d709f998d9229546a345238.tar.zst
dexon-solidity-b12507c55e2ab3cb2d709f998d9229546a345238.zip
Nice Error Report
-rw-r--r--TestHelper.cpp26
-rw-r--r--TestHelper.h8
2 files changed, 33 insertions, 1 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 4a3de4dc..094521a6 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -258,7 +258,11 @@ void ImportTest::compareStates(State const& _stateExpect, State const& _statePos
#define CHECK(a,b) \
{ \
if (_throw == WhenError::Throw) \
- {TBOOST_CHECK_MESSAGE(a,b);}\
+ { \
+ TBOOST_CHECK(a); \
+ if (!a) \
+ std::cerr << b << std::endl;\
+ } \
else \
{TBOOST_WARN_MESSAGE(a,b);} \
}
@@ -773,7 +777,27 @@ Options::Options()
}
else if (arg == "--fulloutput")
fulloutput = true;
+ else if (arg == "--verbosity" && i + 1 < argc)
+ {
+ static std::ostringstream strCout;
+ std::string depthLevel = std::string{argv[i + 1]};
+ if (depthLevel == "0")
+ {
+ logVerbosity = Verbosity::None;
+ std::cout.rdbuf( strCout.rdbuf() );
+ std::cerr.rdbuf( strCout.rdbuf() );
+ }
+ else
+ if (depthLevel == "1")
+ logVerbosity = Verbosity::NiceReport;
+ else
+ logVerbosity = Verbosity::Full;
+ }
}
+
+ //Default option
+ if (logVerbosity == Verbosity::NiceReport)
+ g_logVerbosity = -1; //disable cnote but not the cerr
}
Options const& Options::get()
diff --git a/TestHelper.h b/TestHelper.h
index 5f2f8d6d..a5f50f80 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -218,6 +218,13 @@ void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs)
TBOOST_CHECK((_expectedAddrs == _resultAddrs));
}*/
+enum class Verbosity
+{
+ Full,
+ NiceReport,
+ None
+};
+
class Options
{
public:
@@ -227,6 +234,7 @@ public:
std::string statsOutFile; ///< Stats output file. "out" for standard output
bool checkState = false;///< Throw error when checking test states
bool fulloutput = false;///< Replace large output to just it's length
+ Verbosity logVerbosity = Verbosity::NiceReport;
/// Test selection
/// @{