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

Function hash_set_kernel_test

dlib/test/hash_set.cpp:25–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

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