| 23 | typename hash_map |
| 24 | > |
| 25 | void hash_map_kernel_test ( |
| 26 | ) |
| 27 | /*! |
| 28 | requires |
| 29 | - hash_map is an implementation of hash_map/hash_map_kernel_abstract.h and |
| 30 | is instantiated to map int to int |
| 31 | ensures |
| 32 | - runs tests on hash_map for compliance with the specs |
| 33 | !*/ |
| 34 | { |
| 35 | |
| 36 | srand(static_cast<unsigned int>(time(0))); |
| 37 | |
| 38 | print_spinner(); |
| 39 | |
| 40 | |
| 41 | hash_map test, test2; |
| 42 | |
| 43 | enumerable<map_pair<int,int> >& e = test; |
| 44 | DLIB_TEST(e.at_start() == true); |
| 45 | |
| 46 | for (int j = 0; j < 4; ++j) |
| 47 | { |
| 48 | print_spinner(); |
| 49 | |
| 50 | DLIB_TEST(test.at_start() == true); |
| 51 | DLIB_TEST(test.current_element_valid() == false); |
| 52 | DLIB_TEST(test.move_next() == false); |
| 53 | DLIB_TEST(test.move_next() == false); |
| 54 | DLIB_TEST(test.move_next() == false); |
| 55 | DLIB_TEST(test.move_next() == false); |
| 56 | DLIB_TEST(test.move_next() == false); |
| 57 | DLIB_TEST(test.move_next() == false); |
| 58 | DLIB_TEST(test.move_next() == false); |
| 59 | DLIB_TEST(test.at_start() == false); |
| 60 | DLIB_TEST(test.current_element_valid() == false); |
| 61 | |
| 62 | |
| 63 | DLIB_TEST(test.size() == 0); |
| 64 | DLIB_TEST(test.is_in_domain(5) == false); |
| 65 | DLIB_TEST(test.is_in_domain(0) == false); |
| 66 | DLIB_TEST(test.is_in_domain(-999) == false); |
| 67 | DLIB_TEST(test.is_in_domain(4999) == false); |
| 68 | |
| 69 | |
| 70 | int a,b; |
| 71 | a = 8; |
| 72 | b = 94; |
| 73 | test.add(a,b); |
| 74 | DLIB_TEST(test.size() == 1); |
| 75 | DLIB_TEST(test.is_in_domain(8) == true); |
| 76 | DLIB_TEST(test.is_in_domain(5) == false); |
| 77 | DLIB_TEST(test.is_in_domain(0) == false); |
| 78 | DLIB_TEST(test.is_in_domain(-999) == false); |
| 79 | DLIB_TEST(test.is_in_domain(4999) == false); |
| 80 | DLIB_TEST(test[8] == 94); |
| 81 | a = 53; |
| 82 | b = 4; |
nothing calls this directly
no test coverage detected