13 #include <ecl/config/ecl.hpp> 14 #if defined(ECL_IS_POSIX) 20 #include <gtest/gtest.h> 21 #include <ecl/config/ecl.hpp> 25 #include "../../include/ecl/threads/thread.hpp" 48 static const bool output =
false;
67 std::cout <<
"A::f()" << std::endl;
70 void g(
const int &i) {
72 std::cout <<
"A::g(" << i <<
")" << std::endl;
80 typedef void result_type;
82 for (
int j = 0; j < 3; ++j ) {
84 std::cout <<
" Nullary Function Object: " << i << std::endl;
90 std::cout <<
" Nullary Function Object: finished." << std::endl;
101 for (
int i = 0; i < 5; ++i ) {
104 std::cout <<
" d(): " << i << std::endl;
108 std::cout <<
" d(): finished" << std::endl;
113 std::cout <<
" d(): callback function" << std::endl;
118 for (
int i = 0; i < 3; ++i) {
120 std::cout <<
"f(): " << i << std::endl;
125 void g(
const int &i) {
126 for (
int j = 0; j < 3; ++j) {
128 std::cout <<
"g(" << i <<
")" << std::endl;
134 Thread thread_deconstruct(
d);
145 using namespace ecl::threads::tests;
159 TEST(ThreadTests,threadFunctionTypes) {
176 TEST(ThreadTests,cancelThread) {
179 EXPECT_TRUE(thread.isRunning());
182 EXPECT_FALSE(thread.isRunning());
184 EXPECT_FALSE(thread.isRunning());
187 TEST(ThreadTests,deconstruct) {
193 TEST(ThreadTests,nullaryFunctionObjects) {
195 Thread thread_f8(function_object);
197 Thread thread_f9(
ref(function_object));
204 TEST(ThreadTests,stackSize) {
210 TEST(ThreadTests,delayedStart) {
214 Thread thread1, thread2, thread3, thread4;
216 thread2.start(function_object);
230 int main(
int argc,
char **argv) {
232 testing::InitGoogleTest(&argc,argv);
233 return RUN_ALL_TESTS();
242 int main(
int argc,
char **argv) {
244 std::cout <<
"Currently not supported on your platform." << std::endl;
Embedded control libraries.
TEST(TypeTests, fundamentals)
int main(int argc, char **argv)
ReferenceWrapper< T > ref(T &wrapped_object)
NullaryFreeFunction< R > generateFunctionObject(R(*function)())