Statistics
| Revision:

root / branches / threaded2 / tests / threaded / tests_threaded.cpp @ 752

History | View | Annotate | Download (851 Bytes)

1
#include <iostream>
2
#include <thread>
3
#include <gtest/gtest.h>
4

    
5
class tests_threaded: public ::testing::Test 
6
{
7
protected:
8
  tests_threaded() {
9
  }
10
  virtual ~tests_threaded() {
11
  }
12
  virtual void SetUp() {
13
  }
14
  virtual void TearDown() {
15
  }
16
};
17

    
18
TEST(tests_threaded, main3)
19
{
20
  int main3();
21
  main3();
22
}
23

    
24
/*
25
TEST(tests_threaded, main4)
26
{
27
  int main4();
28
  main4();
29
}
30
*/
31

    
32
void call_from_thread(int tid) 
33
{
34
  std::cout << __FILE__ << ':' << __LINE__ << ' ' << tid << std::endl;
35
}
36

    
37
/*
38
TEST(tests_threaded, example)
39
{
40
  static const int num_threads = 10;
41
  std::thread t[num_threads];
42
  for (int i = 0; i < num_threads; ++i) 
43
  {
44
    t[i] = std::thread(call_from_thread, i);
45
  }
46
  for (int i = 0; i < num_threads; ++i) 
47
  {
48
    t[i].join();
49
  }
50
}
51
*/
52

    
53
int main(int argc, char** argv)
54
{
55
  ::testing::InitGoogleTest(&argc, argv);
56
  return RUN_ALL_TESTS();
57
}