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

Function set_compare_test

dlib/test/set.cpp:24–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

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
swapMethod · 0.45

Tested by

no test coverage detected