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

Function array_expand_test

dlib/test/array.cpp:28–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 typename array
27 >
28 void array_expand_test (
29 )
30 /*!
31 requires
32 - array is an implementation of array/array_sort_abstract.h
33 array is instantiated with unsigned long
34 ensures
35 - runs tests on array for compliance with the specs
36 !*/
37 {
38 dlib::rand rnd;
39
40 DLIB_TEST(dlib::is_array<array>::value == true);
41
42 array a1, a2;
43
44 {
45 array a4(4);
46 DLIB_TEST(a4.size() == 4);
47 }
48
49 {
50 array a1, a2;
51
52 for (int k = 1; k < 100000; k += 1000)
53 {
54 for (int i = 0; i < 10; ++i)
55 {
56 a1.clear();
57 a1.set_max_size(500+k);
58 a1.set_size(500+k);
59 for (unsigned long j = 0; j < a1.size(); ++j)
60 {
61 a1[j] = j;
62 DLIB_TEST(a1[j] == j);
63 }
64 }
65 }
66 }
67
68 DLIB_TEST(a1.max_size() == 0);
69 DLIB_TEST(a2.max_size() == 0);
70
71
72 DLIB_TEST(a1.size() == 0);
73 DLIB_TEST(a1.at_start());
74 DLIB_TEST(a1.current_element_valid() == false);
75 DLIB_TEST(a1.move_next() == false);
76 DLIB_TEST(a1.size() == 0);
77 DLIB_TEST(a1.current_element_valid() == false);
78 DLIB_TEST(a1.at_start() == false);
79 DLIB_TEST(a1.move_next() == false);
80 DLIB_TEST(a1.current_element_valid() == false);
81 DLIB_TEST(a1.size() == 0);
82 DLIB_TEST(a1.at_start() == false);
83 DLIB_TEST(a1.size() == 0);
84
85 swap(a1,a2);

Callers

nothing calls this directly

Calls 15

print_spinnerFunction · 0.85
set_max_sizeMethod · 0.80
sortMethod · 0.80
swapFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
sizeMethod · 0.45
clearMethod · 0.45
set_sizeMethod · 0.45
max_sizeMethod · 0.45
at_startMethod · 0.45

Tested by

no test coverage detected