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

Function sequence_sort_test

dlib/test/sequence.cpp:25–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 typename seq
24 >
25 void sequence_sort_test (
26 )
27 /*!
28 requires
29 - seq is an implementation of sequence/sequence_sort_aseqract.h is instantiated
30 with int
31 ensures
32 - runs tests on seq for compliance with the specs
33 !*/
34 {
35
36
37 srand(static_cast<unsigned int>(time(0)));
38
39
40 print_spinner();
41
42
43
44
45
46 {
47 // this test is to make sure that jumping around via
48 // operator[] doesn't corrupt the object
49
50 seq a;
51
52 for (int i = 0; i < 100; ++i)
53 {
54 int x = i;
55 a.add(a.size(),x);
56 }
57
58
59 int x = 0;
60
61 for (int i = 0; i < (int)a.size(); ++i)
62 {
63 DLIB_TEST_MSG(a[i] >= i,"1");
64 // cout << a[i] << endl;
65 }
66
67 for (unsigned long i = 0; i < a.size(); ++i)
68 {
69 for (unsigned long j = i+1; j < a.size(); ++j)
70 {
71 if ((a[j]+a[i])%3 ==0)
72 {
73 a.remove(j,x);
74 --j;
75 }
76 }
77 }
78
79 //cout << endl;
80
81 for (int i = 0; i < (int)a.size(); ++i)
82 {

Callers

nothing calls this directly

Calls 15

print_spinnerFunction · 0.85
removeMethod · 0.80
sortMethod · 0.80
swapFunction · 0.70
serializeFunction · 0.70
deserializeFunction · 0.70
randClass · 0.50
addMethod · 0.45
sizeMethod · 0.45
at_startMethod · 0.45
current_element_validMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected