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