Changeset 12749
- Timestamp:
- Mar 5, 2014, 7:55:12 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/SystemQueue-tests.cc
r12748 r12749 2 2 #include "ariba/utility/system/SystemQueue.h" 3 3 4 #include <ostream> 5 4 6 using namespace ::testing; 5 7 using namespace ariba::utility; 6 8 using namespace std; 7 9 8 10 /** … … 12 14 { 13 15 SystemQueue& sysq = SystemQueue::instance(); 16 17 // cout << &sysq << endl; 14 18 15 19 EXPECT_FALSE( sysq.isRunning() ); … … 30 34 31 35 // cout << &sysq << endl; 32 ASSERT_TRUE( &sysq == &sysq2 ); 36 37 EXPECT_TRUE( &sysq == &sysq2 ); 33 38 } 34 39 35 40 41 /** 42 * Start and stop the SystemQueue 43 */ 44 TEST(SystemQueue, StartStop) 45 { 46 SystemQueue& sysq = SystemQueue::instance(); 47 48 EXPECT_FALSE( sysq.isRunning() ); 49 50 // start 51 sysq.run(); 52 53 EXPECT_TRUE( sysq.isRunning() ); 54 55 // stop 56 sysq.cancel(); 57 58 EXPECT_FALSE( sysq.isRunning() ); 59 } 60 61 62 /** 63 * Test fixture 64 * 65 * class that can be called by the SystemQueue 66 */ 67 // To use a test fixture, derive a class from testing::Test. 68 class SystemQueueTest : 69 public testing::Test 70 { 71 public: 72 73 SystemQueueTest() : 74 checkmark(false) 75 { 76 } 77 78 void Check() 79 { 80 checkmark = true; 81 // cout << "Hallo Mario ^^" << endl; 82 } 83 84 bool checkmark; 85 }; 86 87 TEST_F(SystemQueueTest, ScheduleCall) 88 { 89 SystemQueue& sysq = SystemQueue::instance(); 90 checkmark = false; // just to be sure.. 91 92 // start 93 sysq.run(); 94 95 // scheduleCall 96 sysq.scheduleCall( 97 boost::bind(&SystemQueueTest::Check, this) 98 ); 99 100 // FIXME: yes, we have to wait a while here... 101 // maybe write a function (in the fixture): wait_for_remaining_events(int max_millisecs) 102 103 // stop 104 sysq.cancel(); 105 106 EXPECT_TRUE( checkmark ); 107 108 /* NOTE: If this fails, maybe we'll have to wait a bit..? 109 * There should be a possibility to cancel the SystemQueue as soon as it's empty.. 110 */ 111 } 112
Note:
See TracChangeset
for help on using the changeset viewer.