Testing library separation: now not in launcher but isolated
[anna.git] / source / testing / TestTimer.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 // Project
10 #include <anna/testing/TestTimer.hpp>
11 #include <anna/core/tracing/Logger.hpp>
12
13 // Standard
14 #include <iostream>
15
16 // Project
17 #include <anna/testing/TestStep.hpp>
18
19
20 using namespace std;
21 using namespace anna;
22 using namespace anna::testing;
23
24 void TestTimer::expire(anna::timex::Engine*)
25 throw(anna::RuntimeException) {
26
27   TestStep *step = getTestCaseStep();
28
29   // action:
30   step->complete();
31
32   LOGDEBUG(
33     string msg("TestTimer::expire | Completed TestStep:\n\n");
34     msg += step->asXMLString();
35     anna::Logger::debug(msg, ANNA_FILE_LOCATION);
36   );
37 }
38
39 const char* TestTimer::asText(const Type::_v type)
40 throw() {
41   static const char* text [] = { "TimeLeft", "Delay" };
42   return text [type];
43 }
44
45
46 string TestTimer::asString() const
47 throw() {
48   string result("TestTimer { ");
49   result += anna::timex::Transaction::asString();
50   result += " Type: ";
51   result += asText(a_type);
52
53 //  const TestStep *step = getTestCaseStep();
54 //
55 //  if(step != NULL) {
56 //    result += " | ";
57 //    result += step->asXMLString();
58 //  } else
59 //    result += " | step: <null>";
60 //  }
61
62 //  switch(getType()) {
63 //    case Type::TimeLeft:
64 //      //result += " | xxxxx: <null>";
65 //      break;
66 //    case Type::Delay:
67 //      //result += " | xxxxx: <null>";
68 //      break;
69 //  }
70
71   return result += " }";
72 }
73