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

Function stack_kernel_test

dlib/test/stack.cpp:24–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 typename stack
23 >
24 void stack_kernel_test (
25 )
26 /*!
27 requires
28 - stack is an implementation of stack/stack_sort_abstract.h
29 stack is instantiated with int
30 ensures
31 - runs tests on stack for compliance with the specs
32 !*/
33 {
34
35
36 srand(static_cast<unsigned int>(time(0)));
37
38 print_spinner();
39
40 stack a1, a2;
41
42
43
44 DLIB_TEST(a1.size() == 0);
45 DLIB_TEST(a1.at_start());
46 DLIB_TEST(a1.current_element_valid() == false);
47 DLIB_TEST(a1.move_next() == false);
48 DLIB_TEST(a1.size() == 0);
49 DLIB_TEST(a1.current_element_valid() == false);
50 DLIB_TEST(a1.at_start() == false);
51 DLIB_TEST(a1.move_next() == false);
52 DLIB_TEST(a1.current_element_valid() == false);
53 DLIB_TEST(a1.size() == 0);
54 DLIB_TEST(a1.at_start() == false);
55 DLIB_TEST(a1.size() == 0);
56
57 swap(a1,a2);
58 DLIB_TEST(a2.size() == 0);
59 DLIB_TEST(a2.current_element_valid() == false);
60 DLIB_TEST(a2.at_start() == false);
61 DLIB_TEST(a2.move_next() == false);
62 DLIB_TEST(a2.current_element_valid() == false);
63 DLIB_TEST(a2.size() == 0);
64 DLIB_TEST(a2.at_start() == false);
65 DLIB_TEST(a2.size() == 0);
66
67
68
69 DLIB_TEST(a1.size() == 0);
70 DLIB_TEST(a1.at_start());
71 DLIB_TEST(a1.current_element_valid() == false);
72 DLIB_TEST(a1.move_next() == false);
73 DLIB_TEST(a1.size() == 0);
74 DLIB_TEST(a1.current_element_valid() == false);
75 DLIB_TEST(a1.at_start() == false);
76 DLIB_TEST(a1.move_next() == false);
77 DLIB_TEST(a1.current_element_valid() == false);
78 DLIB_TEST(a1.size() == 0);
79 DLIB_TEST(a1.at_start() == false);
80 DLIB_TEST(a1.size() == 0);
81

Callers

nothing calls this directly

Calls 14

print_spinnerFunction · 0.85
swapFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
sizeMethod · 0.45
at_startMethod · 0.45
current_element_validMethod · 0.45
move_nextMethod · 0.45
resetMethod · 0.45
clearMethod · 0.45
pushMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected