| 26 | typename map |
| 27 | > |
| 28 | void static_map_kernel_test ( |
| 29 | ) |
| 30 | /*! |
| 31 | requires |
| 32 | - map is an implementation of static_map/static_map_kernel_abstract.h and |
| 33 | is instantiated to map int to int |
| 34 | ensures |
| 35 | - runs tests on map for compliance with the specs |
| 36 | !*/ |
| 37 | { |
| 38 | |
| 39 | print_spinner(); |
| 40 | srand(static_cast<unsigned int>(time(0))); |
| 41 | |
| 42 | typedef binary_search_tree<int,int>::kernel_2a_c bst; |
| 43 | typedef hash_table<int,int>::kernel_1a_c ht; |
| 44 | |
| 45 | const unsigned long table_4_max_size = 100; |
| 46 | const unsigned long tree_max_size = 50000; |
| 47 | ht table_4(4); |
| 48 | ht table_8(8); |
| 49 | bst tree; |
| 50 | |
| 51 | ht table_4b(4); |
| 52 | ht table_8b(8); |
| 53 | bst treeb; |
| 54 | |
| 55 | |
| 56 | // just do the following to make sure operator[] doesn't hang |
| 57 | // under some instances |
| 58 | { |
| 59 | int g = 1, h = 1; |
| 60 | treeb.add(g,h); |
| 61 | map test; |
| 62 | map test2; |
| 63 | |
| 64 | DLIB_TEST(test.size() == 0); |
| 65 | DLIB_TEST(test.at_start()); |
| 66 | DLIB_TEST(test.current_element_valid() == false); |
| 67 | DLIB_TEST(test.move_next() == false); |
| 68 | DLIB_TEST(test.current_element_valid() == false); |
| 69 | DLIB_TEST(test.at_start() == false); |
| 70 | |
| 71 | swap(test,test2); |
| 72 | DLIB_TEST(test2.at_start() == false); |
| 73 | DLIB_TEST(test.at_start() == true); |
| 74 | |
| 75 | swap(test,test2); |
| 76 | DLIB_TEST(test.at_start() == false); |
| 77 | |
| 78 | |
| 79 | DLIB_TEST(test.size() == 0); |
| 80 | DLIB_TEST(test[1] == 0); |
| 81 | DLIB_TEST(test[2] == 0); |
| 82 | DLIB_TEST(test[3] == 0); |
| 83 | DLIB_TEST(test[0] == 0); |
| 84 | |
| 85 | test.load(treeb); |
nothing calls this directly
no test coverage detected