MCPcopy Create free account
hub / github.com/dillo-browser/dillo / testVector2

Function testVector2

test/unit/containers.cc:69–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69void testVector2 ()
70{
71 puts ("--- testVector (2) ---");
72
73 Vector<String> v (true, 1);
74
75 v.insertSorted (new String ("one"));
76 puts (v.toString());
77
78 v.insertSorted (new String ("two"));
79 puts (v.toString());
80
81 v.insertSorted (new String ("three"));
82 puts (v.toString());
83
84 v.insertSorted (new String ("five"));
85 puts (v.toString());
86
87 v.insertSorted (new String ("six"));
88 puts (v.toString());
89
90 v.insertSorted (new String ("four"));
91 puts (v.toString());
92
93 for (int b = 0; b < 2; b++) {
94 bool mustExist = b;
95 printf ("mustExist = %s\n", mustExist ? "true" : "false");
96
97 String k ("alpha");
98 printf (" '%s' -> %d\n", k.chars(), v.bsearch (&k, mustExist));
99
100 for (Iterator<String> it = v.iterator(); it.hasNext(); ) {
101 String *k1 = it.getNext();
102 printf (" '%s' -> %d\n", k1->chars(), v.bsearch (k1, mustExist));
103
104 char buf[64];
105 strcpy (buf, k1->chars());
106 strcat (buf, "-var");
107 String k2 (buf);
108 printf (" '%s' -> %d\n", k2.chars(), v.bsearch (&k2, mustExist));
109 }
110 }
111}
112
113void testVector3 ()
114{

Callers 1

mainFunction · 0.85

Calls 7

toStringMethod · 0.80
charsMethod · 0.80
insertSortedMethod · 0.45
bsearchMethod · 0.45
iteratorMethod · 0.45
hasNextMethod · 0.45
getNextMethod · 0.45

Tested by

no test coverage detected