MCPcopy Create free account
hub / github.com/davisking/dlib / hash_map_kernel_test

Function hash_map_kernel_test

dlib/test/hash_map.cpp:25–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 15

print_spinnerFunction · 0.85
removeMethod · 0.80
swapFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
randClass · 0.50
at_startMethod · 0.45
current_element_validMethod · 0.45
move_nextMethod · 0.45
sizeMethod · 0.45
addMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected