| 25 | typename set |
| 26 | > |
| 27 | void static_set_kernel_test ( |
| 28 | ) |
| 29 | /*! |
| 30 | requires |
| 31 | - set is an implementation of static_set/static_set_kernel_abstract.h and |
| 32 | is instantiated to hold ints |
| 33 | ensures |
| 34 | - runs tests on set for compliance with the specs |
| 35 | !*/ |
| 36 | { |
| 37 | |
| 38 | print_spinner(); |
| 39 | |
| 40 | srand(static_cast<unsigned int>(time(0))); |
| 41 | |
| 42 | typedef dlib::queue<int>::kernel_2a_c queue_of_int; |
| 43 | typedef dlib::set<int>::kernel_1a_c set_of_int; |
| 44 | |
| 45 | queue_of_int q, qb, qc; |
| 46 | set_of_int ds; |
| 47 | |
| 48 | set S; |
| 49 | S.load(ds); |
| 50 | |
| 51 | for (int k = 1; k < 1000; ++k) |
| 52 | { |
| 53 | q.clear(); |
| 54 | qb.clear(); |
| 55 | qc.clear(); |
| 56 | unsigned long num = k; |
| 57 | for (unsigned long i = 0; i < num; ++i) |
| 58 | { |
| 59 | int a = ::rand()&0xFF; |
| 60 | int b = a; |
| 61 | int c = a; |
| 62 | q.enqueue(a); |
| 63 | qb.enqueue(b); |
| 64 | qc.enqueue(c); |
| 65 | } |
| 66 | |
| 67 | |
| 68 | |
| 69 | set s; |
| 70 | |
| 71 | DLIB_TEST(s.size() == 0); |
| 72 | DLIB_TEST(s.at_start()); |
| 73 | DLIB_TEST(s.current_element_valid() == false); |
| 74 | DLIB_TEST(s.move_next() == false); |
| 75 | DLIB_TEST(s.current_element_valid() == false); |
| 76 | DLIB_TEST(s.at_start() == false); |
| 77 | |
| 78 | s.load(q); |
| 79 | DLIB_TEST(s.at_start()); |
| 80 | set se; |
| 81 | se.load(q); |
| 82 | |
| 83 | DLIB_TEST(se.size() == 0); |
| 84 | DLIB_TEST(se.at_start() == true); |
nothing calls this directly
no test coverage detected