| 29 | typename queue |
| 30 | > |
| 31 | void queue_sort_test ( |
| 32 | ) |
| 33 | /*! |
| 34 | requires |
| 35 | - queue is an implementation of queue/queue_sort_abstract.h |
| 36 | is instantiated with int |
| 37 | ensures |
| 38 | - runs tests on queue for compliance with the specs |
| 39 | !*/ |
| 40 | { |
| 41 | |
| 42 | print_spinner(); |
| 43 | srand(static_cast<unsigned int>(time(0))); |
| 44 | |
| 45 | queue q,q2; |
| 46 | |
| 47 | enumerable<int>& e = q; |
| 48 | |
| 49 | // I will use these DLIB_TEST_MSG macros to assert that conditions are true. If they are |
| 50 | // false then it means we have detected an error in the queue object. CASSERT |
| 51 | // will then throw an exception which we will catch at the end of this function and |
| 52 | // report as an error/failed test. |
| 53 | DLIB_TEST(e.at_start() == true); |
| 54 | |
| 55 | int a = 0; |
| 56 | |
| 57 | DLIB_TEST(q.size() == 0); |
| 58 | DLIB_TEST(q.at_start() == true); |
| 59 | DLIB_TEST(q.current_element_valid() == false); |
| 60 | |
| 61 | q.sort(); |
| 62 | |
| 63 | DLIB_TEST(q.size() == 0); |
| 64 | DLIB_TEST(q.at_start() == true); |
| 65 | DLIB_TEST(q.current_element_valid() == false); |
| 66 | |
| 67 | DLIB_TEST (q.move_next() == false); |
| 68 | DLIB_TEST (q.move_next() == false); |
| 69 | DLIB_TEST (q.move_next() == false); |
| 70 | DLIB_TEST (q.move_next() == false); |
| 71 | DLIB_TEST (q.move_next() == false); |
| 72 | DLIB_TEST (q.move_next() == false); |
| 73 | |
| 74 | |
| 75 | DLIB_TEST(q.size() == 0); |
| 76 | DLIB_TEST(q.at_start() == false); |
| 77 | DLIB_TEST(q.current_element_valid() == false); |
| 78 | |
| 79 | |
| 80 | q.reset(); |
| 81 | |
| 82 | DLIB_TEST(q.size() == 0); |
| 83 | DLIB_TEST(q.at_start() == true); |
| 84 | DLIB_TEST(q.current_element_valid() == false); |
| 85 | |
| 86 | |
| 87 | |
| 88 |
nothing calls this directly
no test coverage detected