ts_Thread.cpp
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23 #include <boost/test/unit_test.hpp>
24 #include <icl_core_thread/Thread.h>
25 
27 
28 class TestThread : public Thread
29 {
30 public:
32  : Thread("Test Thread"),
33  m_has_run(false)
34  { }
35 
36  virtual ~TestThread()
37  { }
38 
39  virtual void run()
40  {
41  m_has_run = true;
42  }
43 
44  bool hasRun() const { return m_has_run; }
45 
46 private:
47  bool m_has_run;
48 };
49 
50 BOOST_AUTO_TEST_SUITE(ts_Thread)
51 
53 {
54  TestThread test_thread;
55 
56  BOOST_CHECK(!test_thread.hasRun());
57 
58  test_thread.start();
59  test_thread.stop();
60  test_thread.join();
61 
62  BOOST_CHECK(test_thread.hasRun());
63 }
64 
65 BOOST_AUTO_TEST_SUITE_END()
bool hasRun() const
Definition: ts_Thread.cpp:44
bool m_has_run
Definition: ts_Thread.cpp:47
virtual ~TestThread()
Definition: ts_Thread.cpp:36
BOOST_AUTO_TEST_CASE(RunThread)
Definition: ts_Thread.cpp:52
Contains icl_core::thread::Thread.
virtual void run()
Definition: ts_Thread.cpp:39


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58