Testing library separation: now not in launcher but isolated
[anna.git] / include / anna / testing / TestTimer.hpp
diff --git a/include/anna/testing/TestTimer.hpp b/include/anna/testing/TestTimer.hpp
new file mode 100644 (file)
index 0000000..54ece7b
--- /dev/null
@@ -0,0 +1,55 @@
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
+#ifndef anna_testing_TestTimer_hpp
+#define anna_testing_TestTimer_hpp
+
+#include <anna/core/RuntimeException.hpp>
+#include <anna/core/Allocator.hpp>
+#include <anna/timex/Transaction.hpp>
+
+
+namespace anna {
+
+namespace testing {
+
+
+class TestStep;
+
+
+class TestTimer : public anna::timex::Transaction {
+
+public:
+
+  struct Type { enum _v { TimeLeft, Delay }; };
+  static const char* asText(const Type::_v type) throw();
+
+
+  TestStep* getTestCaseStep() throw() { return reinterpret_cast <TestStep*>(getContext()); }
+  const TestStep* getTestCaseStep() const throw() { return reinterpret_cast <const TestStep*>(getContext()); }
+
+  void setType(const Type::_v type) throw() { a_type = type; }
+  const Type::_v &getType(const Type::_v type) const throw() { return a_type; }
+
+  std::string asString() const throw();
+
+private:
+  Type::_v a_type;
+
+  TestTimer() {;}
+
+  void expire(anna::timex::Engine*) throw(anna::RuntimeException);
+
+  friend class anna::Allocator<TestTimer>;
+};
+
+}
+}
+
+#endif
+