| 26 | typename bst |
| 27 | > |
| 28 | void binary_search_tree_kernel_test ( |
| 29 | ) |
| 30 | /*! |
| 31 | requires |
| 32 | - bst is an implementation of |
| 33 | binary_search_tree/binary_search_tree_kernel_abstract.h is instantiated |
| 34 | to map int to int |
| 35 | ensures |
| 36 | - runs tests on bst for compliance with the specs |
| 37 | !*/ |
| 38 | { |
| 39 | |
| 40 | bst test, test2; |
| 41 | |
| 42 | srand(static_cast<unsigned int>(time(0))); |
| 43 | |
| 44 | |
| 45 | DLIB_TEST(test.count(3) == 0); |
| 46 | |
| 47 | enumerable<map_pair<int,int> >& e = test; |
| 48 | DLIB_TEST(e.at_start() == true); |
| 49 | |
| 50 | DLIB_TEST(test.count(3) == 0); |
| 51 | |
| 52 | for (int i = 0; i < 4; ++i) |
| 53 | { |
| 54 | DLIB_TEST(test.size() == 0); |
| 55 | DLIB_TEST(test.count(3) == 0); |
| 56 | DLIB_TEST(test.height() == 0); |
| 57 | DLIB_TEST(test[5] == 0); |
| 58 | DLIB_TEST(test[0] == 0); |
| 59 | DLIB_TEST(test.at_start()); |
| 60 | DLIB_TEST(test.current_element_valid() == false); |
| 61 | DLIB_TEST(test.count(3) == 0); |
| 62 | |
| 63 | DLIB_TEST(test.move_next() == false); |
| 64 | DLIB_TEST(test.move_next() == false); |
| 65 | DLIB_TEST(test.move_next() == false); |
| 66 | DLIB_TEST(test.move_next() == false); |
| 67 | DLIB_TEST(test.move_next() == false); |
| 68 | DLIB_TEST(test.count(3) == 0); |
| 69 | |
| 70 | DLIB_TEST(test.at_start() == false); |
| 71 | DLIB_TEST(test.current_element_valid() == false); |
| 72 | |
| 73 | test.clear(); |
| 74 | test.position_enumerator(5); |
| 75 | DLIB_TEST(test.current_element_valid() == false); |
| 76 | DLIB_TEST(test.at_start() == false); |
| 77 | test.position_enumerator(5); |
| 78 | DLIB_TEST(test.current_element_valid() == false); |
| 79 | DLIB_TEST(test.at_start() == false); |
| 80 | test.position_enumerator(9); |
| 81 | DLIB_TEST(test.current_element_valid() == false); |
| 82 | DLIB_TEST(test.at_start() == false); |
| 83 | test.clear(); |
| 84 | test.position_enumerator(5); |
| 85 | DLIB_TEST(test.current_element_valid() == false); |
nothing calls this directly
no test coverage detected