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

Function sliding_buffer_kernel_test

dlib/test/sliding_buffer.cpp:25–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 typename buf
24 >
25 void sliding_buffer_kernel_test (
26 )
27 /*!
28 requires
29 - buf is an implementation of sliding_buffer/sliding_buffer_kernel_abstract.h
30 - buf is instantiated with T=unsigned char
31 ensures
32 - runs tests on buf for compliance with the specs
33 !*/
34 {
35
36 print_spinner();
37
38 buf test;
39
40 DLIB_TEST(test.size() == 0);
41
42 test.set_size(3);
43 buf test2;
44
45 DLIB_TEST(test.size() == 8);
46
47 for (int g = 0; g < 2; ++g)
48 {
49
50 test.clear();
51
52 DLIB_TEST(test.size() == 0);
53 test.set_size(2);
54
55 DLIB_TEST(test.size() == 4);
56
57
58
59 test[0] = 'a';
60 test[1] = 's';
61 test[2] = 'd';
62 test[3] = 'f';
63
64 unsigned long id = test.get_element_id(2);
65 DLIB_TEST(test[test.get_element_index(id)] == 'd');
66
67
68 DLIB_TEST(test[0] == 'a');
69 DLIB_TEST(test[1] == 's');
70 DLIB_TEST(test[2] == 'd');
71 DLIB_TEST(test[3] == 'f');
72
73 DLIB_TEST(test2.size() == 0);
74 swap(test,test2);
75 DLIB_TEST(test2.size() == 4);
76
77 DLIB_TEST(test2[0] == 'a');
78 DLIB_TEST(test2[1] == 's');
79 DLIB_TEST(test2[2] == 'd');
80 DLIB_TEST(test2[3] == 'f');
81
82 swap(test,test2);

Callers

nothing calls this directly

Calls 15

print_spinnerFunction · 0.85
get_element_idMethod · 0.80
get_element_indexMethod · 0.80
rotate_leftMethod · 0.80
rotate_rightMethod · 0.80
swapFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
sizeMethod · 0.45
set_sizeMethod · 0.45
clearMethod · 0.45
at_startMethod · 0.45

Tested by

no test coverage detected