Remove dynamic exceptions
[anna.git] / source / testing / TestCase.cpp
index 8c38d06..991a254 100644 (file)
@@ -33,18 +33,18 @@ using namespace anna::testing;
 
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-void TestCase::DebugSummary::addHint(const std::string &hint) throw() {
+void TestCase::DebugSummary::addHint(const std::string &hint) {
   event_t event;
   event.Timestamp = anna::functions::millisecond();
   event.Hint = hint;
   a_events.push_back(event);
 }
 
-void TestCase::DebugSummary::clear() throw() {
+void TestCase::DebugSummary::clear() {
   a_events.clear();
 }
 
-anna::xml::Node* TestCase::DebugSummary::asXML(anna::xml::Node* parent) const throw() {
+anna::xml::Node* TestCase::DebugSummary::asXML(anna::xml::Node* parent) const {
   anna::xml::Node* result = parent->createChild("DebugSummary");
 
   std::vector<event_t>::const_iterator it;
@@ -57,7 +57,7 @@ anna::xml::Node* TestCase::DebugSummary::asXML(anna::xml::Node* parent) const th
   return result;
 };
 
-std::string TestCase::DebugSummary::asString() const throw() {
+std::string TestCase::DebugSummary::asString() const {
   std::string result = "";
 
   std::vector<event_t>::const_iterator it;
@@ -93,17 +93,17 @@ TestCase::~TestCase() {
 
 
 const char* TestCase::asText(const State::_v state)
-throw() {
+{
   static const char* text [] = { "Initialized", "InProgress", "Failed", "Success" };
   return text [state];
 }
 
-anna::Millisecond TestCase::getLapseMs() const throw() {
+anna::Millisecond TestCase::getLapseMs() const {
   return ((a_finishTimestamp >= a_startTimestamp) ? (a_finishTimestamp - a_startTimestamp) : (anna::Millisecond)0);
 }
 
 anna::xml::Node* TestCase::asXML(anna::xml::Node* parent) const
-throw() {
+{
   anna::xml::Node* result = parent->createChild("TestCase");
 
   result->createAttribute("Id", a_id);
@@ -134,12 +134,12 @@ throw() {
   return result;
 }
 
-std::string TestCase::asXMLString() const throw() {
+std::string TestCase::asXMLString() const {
   anna::xml::Node root("root");
   return anna::xml::Compiler().apply(asXML(&root));
 }
 
-bool TestCase::hasSameCondition(const TestDiameterCondition &condition) const throw() {
+bool TestCase::hasSameCondition(const TestDiameterCondition &condition) const {
   std::vector<TestStep*>::const_iterator it;
   TestStepWaitDiameter *step;
   for (it = a_steps.begin(); it != a_steps.end(); it++) {
@@ -151,7 +151,7 @@ bool TestCase::hasSameCondition(const TestDiameterCondition &condition) const th
 }
 
 
-void TestCase::setState(const State::_v &state) throw() {
+void TestCase::setState(const State::_v &state) {
 
   State::_v previousState = a_state;
   if (state == previousState) return;
@@ -215,7 +215,7 @@ void TestCase::setState(const State::_v &state) throw() {
   }
 }
 
-bool TestCase::done() throw() {
+bool TestCase::done() {
   if (a_stepsIt == a_steps.end()) {
     setState(State::Success);
     return true;
@@ -224,7 +224,7 @@ bool TestCase::done() throw() {
   return false;
 }
 
-bool TestCase::process() throw() {
+bool TestCase::process() {
   if (steps() == 0) {
     LOGWARNING(anna::Logger::warning(anna::functions::asString("Test case %llu (%s) is empty, nothing to execute", a_id, a_description.c_str()), ANNA_FILE_LOCATION));
     return false;
@@ -264,7 +264,7 @@ bool TestCase::process() throw() {
   return somethingDone;
 }
 
-bool TestCase::reset(bool hard) throw() {
+bool TestCase::reset(bool hard) {
 
   // Soft reset if finished:
   if (!hard /* is soft reset */  && !isFinished()) return false;
@@ -306,12 +306,12 @@ bool TestCase::safeToClear() {
   return true;
 }
 
-void TestCase::assertInitialized() const throw(anna::RuntimeException) {
+void TestCase::assertInitialized() const noexcept(false) {
   if (isFinished())
     throw anna::RuntimeException(anna::functions::asString("Cannot program anymore. The test case %llu (%s) has finished. You must reset it to append new steps (or do it during execution, which is also allowed).", a_id, a_description.c_str()), ANNA_FILE_LOCATION);
 }
 
-void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(anna::RuntimeException) {
+void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) noexcept(false) {
 
   bool isRequest = anna::diameter::codec::functions::isRequest(db);
   bool registerKeys = ((isRequest && toEntity) || (!isRequest && !toEntity) /* (*) */);
@@ -342,14 +342,14 @@ void TestCase::assertMessage(const anna::DataBlock &db, bool toEntity) throw(ann
   }
 }
 
-void TestCase::addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException) {
+void TestCase::addTimeout(const anna::Millisecond &timeout) noexcept(false) {
   assertInitialized();
   TestStepTimeout *step = new TestStepTimeout(this);
   step->setTimeout(timeout);
   addStep(step);
 }
 
-void TestCase::addSendDiameterXml2e(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) throw(anna::RuntimeException) {
+void TestCase::addSendDiameterXml2e(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) noexcept(false) {
   assertInitialized();
   assertMessage(db, true /* to entity */);
 
@@ -374,7 +374,7 @@ void TestCase::addSendDiameterXml2e(const anna::DataBlock &db, anna::diameter::c
   addStep(step);
 }
 
-void TestCase::addSendDiameterXml2c(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) throw(anna::RuntimeException) {
+void TestCase::addSendDiameterXml2c(const anna::DataBlock &db, anna::diameter::comm::OriginHost *host, int stepNumber) noexcept(false) {
   assertInitialized();
   assertMessage(db, false /* to client */);
 
@@ -399,7 +399,7 @@ void TestCase::addSendDiameterXml2c(const anna::DataBlock &db, anna::diameter::c
   addStep(step);
 }
 
-void TestCase::addDelay(const anna::Millisecond &delay) throw(anna::RuntimeException) {
+void TestCase::addDelay(const anna::Millisecond &delay) noexcept(false) {
   assertInitialized();
   TestStepDelay *step = new TestStepDelay(this);
   step->setDelay(delay);
@@ -409,7 +409,7 @@ void TestCase::addDelay(const anna::Millisecond &delay) throw(anna::RuntimeExcep
 void TestCase::addWaitDiameter(bool fromEntity,
               const std::string &code, const std::string &bitR, const std::string &hopByHop, const std::string &applicationId,
               const std::string &sessionId, const std::string &resultCode,
-              const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) throw(anna::RuntimeException) {
+              const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) noexcept(false) {
   assertInitialized();
   std::string usedHopByHop = hopByHop;
   TestStepWaitDiameter *step = NULL;
@@ -461,7 +461,7 @@ void TestCase::addWaitDiameter(bool fromEntity,
   addStep(step);
 }
 
-void TestCase::addWaitDiameterRegexpHex(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException) {
+void TestCase::addWaitDiameterRegexpHex(bool fromEntity, const std::string &regexp) noexcept(false) {
   assertInitialized();
 
   TestStepWaitDiameter *step = new TestStepWaitDiameter(this);
@@ -475,7 +475,7 @@ void TestCase::addWaitDiameterRegexpHex(bool fromEntity, const std::string &rege
   addStep(step);
 }
 
-void TestCase::addWaitDiameterRegexpXml(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException) {
+void TestCase::addWaitDiameterRegexpXml(bool fromEntity, const std::string &regexp) noexcept(false) {
   assertInitialized();
 
   TestStepWaitDiameter *step = new TestStepWaitDiameter(this);
@@ -489,7 +489,7 @@ void TestCase::addWaitDiameterRegexpXml(bool fromEntity, const std::string &rege
   addStep(step);
 }
 
-void TestCase::addCommand(const std::string &cmd) throw(anna::RuntimeException) {
+void TestCase::addCommand(const std::string &cmd) noexcept(false) {
   assertInitialized();
 
   TestStepCmd *step = new TestStepCmd(this);
@@ -498,7 +498,7 @@ void TestCase::addCommand(const std::string &cmd) throw(anna::RuntimeException)
   addStep(step);
 }
 
-void TestCase::addIpLimit(unsigned int ipLimit) throw(anna::RuntimeException) {
+void TestCase::addIpLimit(unsigned int ipLimit) noexcept(false) {
   assertInitialized();
 
   TestStepIpLimit *step = new TestStepIpLimit(this);
@@ -507,7 +507,7 @@ void TestCase::addIpLimit(unsigned int ipLimit) throw(anna::RuntimeException) {
   addStep(step);
 }
 
-TestStepWaitDiameter *TestCase::searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) throw() {
+TestStepWaitDiameter *TestCase::searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) {
 
   TestStepWaitDiameter *result;
   for (std::vector<TestStep*>::const_iterator it = a_stepsIt /* current */; it != a_steps.end(); it++) {
@@ -521,7 +521,7 @@ TestStepWaitDiameter *TestCase::searchNextWaitConditionFulfilled(const anna::Dat
   return NULL;
 }
 
-const TestStep *TestCase::getStep(int stepNumber) const throw() {
+const TestStep *TestCase::getStep(int stepNumber) const {
   if (stepNumber < 1 || stepNumber > steps()) return NULL;
 //  return a_steps.at(stepNumber-1);  // http://stackoverflow.com/questions/3269809/stdvectorat-vs-operator-surprising-results-5-to-10-times-slower-f
   return a_steps[stepNumber-1];