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 }
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:54
RobotMemoryTestEnvironment
Environment for running Tests of the RobotMemory Necessary for making object such as the robot memory...
Definition: robot_memory_test.h:37
fawkes::Thread::name
const char * name() const
Definition: thread.h:99
RobotMemoryTestThread::loop
virtual void loop()
Code to execute in the thread.
Definition: robot_memory_test_thread.cpp:52
fawkes::LoggingAspect::logger
Logger * logger
Definition: logging.h:50
RobotMemoryTestThread::init
virtual void init()
Initialize the thread.
Definition: robot_memory_test_thread.cpp:43
fawkes
fawkes::RobotMemoryAspect::robot_memory
RobotMemory * robot_memory
RobotMemory object for storing and querying information.
Definition: robot_memory_aspect.h:55
fawkes::Logger::log_warn
virtual void log_warn(const char *component, const char *format,...)=0
fawkes::Thread
Definition: thread.h:44
fawkes::BlackBoardAspect::blackboard
BlackBoard * blackboard
Definition: blackboard.h:47
RobotMemoryTestThread::finalize
virtual void finalize()
Finalize the thread.
Definition: robot_memory_test_thread.cpp:63