| 246 | typename pipe |
| 247 | > |
| 248 | void pipe_kernel_test ( |
| 249 | ) |
| 250 | /*! |
| 251 | requires |
| 252 | - pipe is an implementation of pipe/pipe_kernel_abstract.h and |
| 253 | is instantiated with int |
| 254 | ensures |
| 255 | - runs tests on pipe for compliance with the specs |
| 256 | !*/ |
| 257 | { |
| 258 | using namespace pipe_kernel_test_helpers; |
| 259 | found_error = false; |
| 260 | |
| 261 | |
| 262 | print_spinner(); |
| 263 | pipe test(10), test2(100); |
| 264 | pipe test_0(0), test2_0(0); |
| 265 | pipe test_1(1), test2_1(1); |
| 266 | |
| 267 | DLIB_TEST(test.size() == 0); |
| 268 | DLIB_TEST(test2.size() == 0); |
| 269 | DLIB_TEST(test_0.size() == 0); |
| 270 | DLIB_TEST(test2_0.size() == 0); |
| 271 | DLIB_TEST(test_1.size() == 0); |
| 272 | DLIB_TEST(test2_1.size() == 0); |
| 273 | |
| 274 | DLIB_TEST(test.is_enqueue_enabled() == true); |
| 275 | DLIB_TEST(test.is_dequeue_enabled() == true); |
| 276 | DLIB_TEST(test.is_enabled() == true); |
| 277 | |
| 278 | test.empty(); |
| 279 | test2.empty(); |
| 280 | DLIB_TEST(test.size() == 0); |
| 281 | DLIB_TEST(test2.size() == 0); |
| 282 | |
| 283 | test_0.empty(); |
| 284 | test2_0.empty(); |
| 285 | DLIB_TEST(test_0.size() == 0); |
| 286 | DLIB_TEST(test2_0.size() == 0); |
| 287 | |
| 288 | test_1.empty(); |
| 289 | test2_1.empty(); |
| 290 | DLIB_TEST(test_1.size() == 0); |
| 291 | DLIB_TEST(test2_1.size() == 0); |
| 292 | |
| 293 | |
| 294 | |
| 295 | int a; |
| 296 | a = 3; |
| 297 | test.enqueue(a); |
| 298 | DLIB_TEST(test.size() == 1); |
| 299 | a = 5; |
| 300 | test.enqueue(a); |
| 301 | DLIB_TEST(test.size() == 2); |
| 302 | |
| 303 | a = 0; |
| 304 | test.dequeue(a); |
| 305 | DLIB_TEST(a == 3); |
nothing calls this directly
no test coverage detected