Fawkes API  Fawkes Development Version
robot_memory_test_thread.cpp
1 
2 /***************************************************************************
3  * robot_memory_test_thread.cpp - robot_memory_test
4  *
5  * Plugin created: Wed Aug 24 13:37:27 2016
6 
7  * Copyright 2016 Frederik Zwilling
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #include "robot_memory_test_thread.h"
25 
26 #include <baseapp/run.h>
27 #include <core/exception.h>
28 #include <gtest/gtest.h>
29 
30 using namespace fawkes;
31 
32 /** @class RobotMemoryTestThread 'robot_memory_test_thread.h'
33  * gtests for the RobotMemory
34  * @author Frederik Zwilling
35  */
36 
37 RobotMemoryTestThread::RobotMemoryTestThread()
38 : Thread("RobotMemoryTestThread", Thread::OPMODE_WAITFORWAKEUP),
39  BlockedTimingAspect(BlockedTimingAspect::WAKEUP_HOOK_SKILL)
40 {
41 }
42 
43 void
45 {
46  //prepare tests
47  logger->log_warn(name(), "Preparing tests");
49  ::testing::AddGlobalTestEnvironment((testing::Environment *)test_env_);
50 }
51 
52 void
54 {
55  logger->log_warn(name(), "Starting tests");
56  test_result_ = RUN_ALL_TESTS();
57  usleep(100000);
58  logger->log_warn(name(), "Finished tests with, quitting as intended...");
59  //stop fawkes to finish the testing run
60  fawkes::runtime::quit();
61 }
62 
63 void
65 {
66 }
Environment for running Tests of the RobotMemory Necessary for making object such as the robot memory...
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
BlackBoard * blackboard
This is the BlackBoard instance you can use to interact with the BlackBoard.
Definition: blackboard.h:44
Thread aspect to use blocked timing.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
Logger * logger
This is the Logger member used to access the logger.
Definition: logging.h:41
RobotMemory * robot_memory
RobotMemory object for storing and querying information.
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Fawkes library namespace.