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

Function static_map_kernel_test

dlib/test/static_map.cpp:28–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected