| 137 | typename timer_t |
| 138 | > |
| 139 | void timer_test2 ( |
| 140 | ) |
| 141 | /*! |
| 142 | requires |
| 143 | - timer_t is an implementation of dlib/timer/timer_abstract.h is instantiated |
| 144 | timer_test_helper |
| 145 | ensures |
| 146 | - runs tests on timer_t for compliance with the specs |
| 147 | !*/ |
| 148 | { |
| 149 | for (int j = 0; j < 4; ++j) |
| 150 | { |
| 151 | print_spinner(); |
| 152 | timer_test_helper h; |
| 153 | |
| 154 | timer_t t1(h,&timer_test_helper::set_timestamp); |
| 155 | t1.set_delay_time(0); |
| 156 | dlog << LTRACE << "t1.start()"; |
| 157 | t1.start(); |
| 158 | |
| 159 | dlib::sleep(60); |
| 160 | print_spinner(); |
| 161 | t1.stop_and_wait(); |
| 162 | |
| 163 | dlib::uint64 cur_time = h.ts.get_timestamp(); |
| 164 | dlog << LTRACE << "get current time: " << cur_time; |
| 165 | |
| 166 | // make sure the action function has been called recently |
| 167 | DLIB_TEST_MSG((cur_time-h.timestamp)/1000 < 30, (cur_time-h.timestamp)/1000); |
| 168 | |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | template < |
| 173 | typename timer_t |
nothing calls this directly
no test coverage detected