author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Thu, 22 Apr 2010 16:15:11 +0300 | |
branch | RCL_3 |
changeset 14 | 8c4229025c0b |
parent 7 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include <QObject> |
|
43 |
#include <QTest> |
|
44 |
#include <QCache> |
|
45 |
#include <QContiguousCache> |
|
46 |
||
47 |
#include <QDebug> |
|
48 |
#include <stdio.h> |
|
49 |
||
50 |
class tst_QContiguousCache : public QObject |
|
51 |
{ |
|
52 |
Q_OBJECT |
|
53 |
public: |
|
54 |
tst_QContiguousCache() {} |
|
55 |
virtual ~tst_QContiguousCache() {} |
|
56 |
private slots: |
|
57 |
void empty(); |
|
58 |
void append_data(); |
|
59 |
void append(); |
|
60 |
||
61 |
void prepend_data(); |
|
62 |
void prepend(); |
|
63 |
||
64 |
void asScrollingList(); |
|
65 |
||
66 |
void complexType(); |
|
67 |
||
68 |
void operatorAt(); |
|
69 |
||
70 |
void cacheBenchmark(); |
|
71 |
void contiguousCacheBenchmark(); |
|
72 |
||
73 |
void setCapacity(); |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
74 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
75 |
void zeroCapacity(); |
0 | 76 |
}; |
77 |
||
78 |
QTEST_MAIN(tst_QContiguousCache) |
|
79 |
||
80 |
void tst_QContiguousCache::empty() |
|
81 |
{ |
|
82 |
QContiguousCache<int> c(10); |
|
83 |
QCOMPARE(c.capacity(), 10); |
|
84 |
QCOMPARE(c.count(), 0); |
|
85 |
QVERIFY(c.isEmpty()); |
|
86 |
c.append(1); |
|
87 |
QCOMPARE(c.count(), 1); |
|
88 |
QVERIFY(!c.isEmpty()); |
|
89 |
c.clear(); |
|
90 |
QCOMPARE(c.capacity(), 10); |
|
91 |
QCOMPARE(c.count(), 0); |
|
92 |
QVERIFY(c.isEmpty()); |
|
93 |
c.prepend(1); |
|
94 |
QCOMPARE(c.count(), 1); |
|
95 |
QVERIFY(!c.isEmpty()); |
|
96 |
c.clear(); |
|
97 |
QCOMPARE(c.count(), 0); |
|
98 |
QVERIFY(c.isEmpty()); |
|
99 |
QCOMPARE(c.capacity(), 10); |
|
100 |
} |
|
101 |
||
102 |
void tst_QContiguousCache::append_data() |
|
103 |
{ |
|
104 |
QTest::addColumn<int>("start"); |
|
105 |
QTest::addColumn<int>("count"); |
|
106 |
QTest::addColumn<int>("cacheSize"); |
|
107 |
QTest::addColumn<bool>("invalidIndexes"); |
|
108 |
||
109 |
QTest::newRow("0+30[10]") << 0 << 30 << 10 << false; |
|
110 |
QTest::newRow("300+30[10]") << 300 << 30 << 10 << false; |
|
111 |
QTest::newRow("MAX-10+30[10]") << INT_MAX-10 << 30 << 10 << true; |
|
112 |
} |
|
113 |
||
114 |
void tst_QContiguousCache::append() |
|
115 |
{ |
|
116 |
QFETCH(int, start); |
|
117 |
QFETCH(int, count); |
|
118 |
QFETCH(int, cacheSize); |
|
119 |
QFETCH(bool, invalidIndexes); |
|
120 |
||
121 |
int i, j; |
|
122 |
QContiguousCache<int> c(cacheSize); |
|
123 |
||
124 |
i = 1; |
|
125 |
QCOMPARE(c.available(), cacheSize); |
|
126 |
if (start == 0) |
|
127 |
c.append(i++); |
|
128 |
else |
|
129 |
c.insert(start, i++); |
|
130 |
while (i < count) { |
|
131 |
c.append(i); |
|
132 |
QCOMPARE(c.available(), qMax(0, cacheSize - i)); |
|
133 |
QCOMPARE(c.first(), qMax(1, i-cacheSize+1)); |
|
134 |
QCOMPARE(c.last(), i); |
|
135 |
QCOMPARE(c.count(), qMin(i, cacheSize)); |
|
136 |
QCOMPARE(c.isFull(), i >= cacheSize); |
|
137 |
i++; |
|
138 |
} |
|
139 |
||
140 |
QCOMPARE(c.areIndexesValid(), !invalidIndexes); |
|
141 |
if (invalidIndexes) |
|
142 |
c.normalizeIndexes(); |
|
143 |
QVERIFY(c.areIndexesValid()); |
|
144 |
||
145 |
// test taking from end until empty. |
|
146 |
for (j = 0; j < cacheSize; j++, i--) { |
|
147 |
QCOMPARE(c.takeLast(), i-1); |
|
148 |
QCOMPARE(c.count(), cacheSize-j-1); |
|
149 |
QCOMPARE(c.available(), j+1); |
|
150 |
QVERIFY(!c.isFull()); |
|
151 |
QCOMPARE(c.isEmpty(), j==cacheSize-1); |
|
152 |
} |
|
153 |
||
154 |
} |
|
155 |
||
156 |
void tst_QContiguousCache::prepend_data() |
|
157 |
{ |
|
158 |
QTest::addColumn<int>("start"); |
|
159 |
QTest::addColumn<int>("count"); |
|
160 |
QTest::addColumn<int>("cacheSize"); |
|
161 |
QTest::addColumn<bool>("invalidIndexes"); |
|
162 |
||
163 |
QTest::newRow("30-30[10]") << 30 << 30 << 10 << false; |
|
164 |
QTest::newRow("300-30[10]") << 300 << 30 << 10 << false; |
|
165 |
QTest::newRow("10-30[10]") << 10 << 30 << 10 << true; |
|
166 |
} |
|
167 |
||
168 |
void tst_QContiguousCache::prepend() |
|
169 |
{ |
|
170 |
QFETCH(int, start); |
|
171 |
QFETCH(int, count); |
|
172 |
QFETCH(int, cacheSize); |
|
173 |
QFETCH(bool, invalidIndexes); |
|
174 |
||
175 |
int i, j; |
|
176 |
QContiguousCache<int> c(cacheSize); |
|
177 |
||
178 |
i = 1; |
|
179 |
QCOMPARE(c.available(), cacheSize); |
|
180 |
c.insert(start, i++); |
|
181 |
while(i < count) { |
|
182 |
c.prepend(i); |
|
183 |
QCOMPARE(c.available(), qMax(0, cacheSize - i)); |
|
184 |
QCOMPARE(c.last(), qMax(1, i-cacheSize+1)); |
|
185 |
QCOMPARE(c.first(), i); |
|
186 |
QCOMPARE(c.count(), qMin(i, cacheSize)); |
|
187 |
QCOMPARE(c.isFull(), i >= cacheSize); |
|
188 |
i++; |
|
189 |
} |
|
190 |
||
191 |
QCOMPARE(c.areIndexesValid(), !invalidIndexes); |
|
192 |
if (invalidIndexes) |
|
193 |
c.normalizeIndexes(); |
|
194 |
QVERIFY(c.areIndexesValid()); |
|
195 |
||
196 |
// test taking from start until empty. |
|
197 |
for (j = 0; j < cacheSize; j++, i--) { |
|
198 |
QCOMPARE(c.takeFirst(), i-1); |
|
199 |
QCOMPARE(c.count(), cacheSize-j-1); |
|
200 |
QCOMPARE(c.available(), j+1); |
|
201 |
QVERIFY(!c.isFull()); |
|
202 |
QCOMPARE(c.isEmpty(), j==cacheSize-1); |
|
203 |
} |
|
204 |
} |
|
205 |
||
206 |
void tst_QContiguousCache::asScrollingList() |
|
207 |
{ |
|
208 |
int i; |
|
209 |
QContiguousCache<int> c(10); |
|
210 |
||
211 |
// Once allocated QContiguousCache should not |
|
212 |
// allocate any additional memory for non |
|
213 |
// complex data types. |
|
214 |
QBENCHMARK { |
|
215 |
// simulate scrolling in a list of items; |
|
216 |
for(i = 0; i < 10; ++i) { |
|
217 |
QCOMPARE(c.available(), 10-i); |
|
218 |
c.append(i); |
|
219 |
} |
|
220 |
||
221 |
QCOMPARE(c.firstIndex(), 0); |
|
222 |
QCOMPARE(c.lastIndex(), 9); |
|
223 |
QCOMPARE(c.first(), 0); |
|
224 |
QCOMPARE(c.last(), 9); |
|
225 |
QVERIFY(!c.containsIndex(-1)); |
|
226 |
QVERIFY(!c.containsIndex(10)); |
|
227 |
QCOMPARE(c.available(), 0); |
|
228 |
||
229 |
for (i = 0; i < 10; ++i) { |
|
230 |
QVERIFY(c.containsIndex(i)); |
|
231 |
QCOMPARE(c.at(i), i); |
|
232 |
QCOMPARE(c[i], i); |
|
233 |
QCOMPARE(((const QContiguousCache<int>)c)[i], i); |
|
234 |
} |
|
235 |
||
236 |
for (i = 10; i < 30; ++i) |
|
237 |
c.append(i); |
|
238 |
||
239 |
QCOMPARE(c.firstIndex(), 20); |
|
240 |
QCOMPARE(c.lastIndex(), 29); |
|
241 |
QCOMPARE(c.first(), 20); |
|
242 |
QCOMPARE(c.last(), 29); |
|
243 |
QVERIFY(!c.containsIndex(19)); |
|
244 |
QVERIFY(!c.containsIndex(30)); |
|
245 |
QCOMPARE(c.available(), 0); |
|
246 |
||
247 |
for (i = 20; i < 30; ++i) { |
|
248 |
QVERIFY(c.containsIndex(i)); |
|
249 |
QCOMPARE(c.at(i), i); |
|
250 |
QCOMPARE(c[i], i); |
|
251 |
QCOMPARE(((const QContiguousCache<int> )c)[i], i); |
|
252 |
} |
|
253 |
||
254 |
for (i = 19; i >= 10; --i) |
|
255 |
c.prepend(i); |
|
256 |
||
257 |
QCOMPARE(c.firstIndex(), 10); |
|
258 |
QCOMPARE(c.lastIndex(), 19); |
|
259 |
QCOMPARE(c.first(), 10); |
|
260 |
QCOMPARE(c.last(), 19); |
|
261 |
QVERIFY(!c.containsIndex(9)); |
|
262 |
QVERIFY(!c.containsIndex(20)); |
|
263 |
QCOMPARE(c.available(), 0); |
|
264 |
||
265 |
for (i = 10; i < 20; ++i) { |
|
266 |
QVERIFY(c.containsIndex(i)); |
|
267 |
QCOMPARE(c.at(i), i); |
|
268 |
QCOMPARE(c[i], i); |
|
269 |
QCOMPARE(((const QContiguousCache<int> )c)[i], i); |
|
270 |
} |
|
271 |
||
272 |
for (i = 200; i < 220; ++i) |
|
273 |
c.insert(i, i); |
|
274 |
||
275 |
QCOMPARE(c.firstIndex(), 210); |
|
276 |
QCOMPARE(c.lastIndex(), 219); |
|
277 |
QCOMPARE(c.first(), 210); |
|
278 |
QCOMPARE(c.last(), 219); |
|
279 |
QVERIFY(!c.containsIndex(209)); |
|
280 |
QVERIFY(!c.containsIndex(300)); |
|
281 |
QCOMPARE(c.available(), 0); |
|
282 |
||
283 |
for (i = 210; i < 220; ++i) { |
|
284 |
QVERIFY(c.containsIndex(i)); |
|
285 |
QCOMPARE(c.at(i), i); |
|
286 |
QCOMPARE(c[i], i); |
|
287 |
QCOMPARE(((const QContiguousCache<int> )c)[i], i); |
|
288 |
} |
|
289 |
c.clear(); // needed to reset benchmark |
|
290 |
} |
|
291 |
||
292 |
// from a specific bug that was encountered. 100 to 299 cached, attempted to cache 250 - 205 via insert, failed. |
|
293 |
// bug was that item at 150 would instead be item that should have been inserted at 250 |
|
294 |
c.setCapacity(200); |
|
295 |
for(i = 100; i < 300; ++i) |
|
296 |
c.insert(i, i); |
|
297 |
for (i = 250; i <= 306; ++i) |
|
298 |
c.insert(i, 1000+i); |
|
299 |
for (i = 107; i <= 306; ++i) { |
|
300 |
QVERIFY(c.containsIndex(i)); |
|
301 |
QCOMPARE(c.at(i), i < 250 ? i : 1000+i); |
|
302 |
} |
|
303 |
} |
|
304 |
||
305 |
struct RefCountingClassData |
|
306 |
{ |
|
307 |
QBasicAtomicInt ref; |
|
308 |
static RefCountingClassData shared_null; |
|
309 |
}; |
|
310 |
||
311 |
RefCountingClassData RefCountingClassData::shared_null = { |
|
312 |
Q_BASIC_ATOMIC_INITIALIZER(1) |
|
313 |
}; |
|
314 |
||
315 |
class RefCountingClass |
|
316 |
{ |
|
317 |
public: |
|
318 |
RefCountingClass() : d(&RefCountingClassData::shared_null) { d->ref.ref(); } |
|
319 |
||
320 |
RefCountingClass(const RefCountingClass &other) |
|
321 |
{ |
|
322 |
d = other.d; |
|
323 |
d->ref.ref(); |
|
324 |
} |
|
325 |
||
326 |
~RefCountingClass() |
|
327 |
{ |
|
328 |
if (!d->ref.deref()) |
|
329 |
delete d; |
|
330 |
} |
|
331 |
||
332 |
RefCountingClass &operator=(const RefCountingClass &other) |
|
333 |
{ |
|
334 |
if (!d->ref.deref()) |
|
335 |
delete d; |
|
336 |
d = other.d; |
|
337 |
d->ref.ref(); |
|
338 |
return *this; |
|
339 |
} |
|
340 |
||
341 |
int refCount() const { return d->ref; } |
|
342 |
private: |
|
343 |
RefCountingClassData *d; |
|
344 |
}; |
|
345 |
||
346 |
void tst_QContiguousCache::complexType() |
|
347 |
{ |
|
348 |
RefCountingClass original; |
|
349 |
||
350 |
QContiguousCache<RefCountingClass> contiguousCache(10); |
|
351 |
contiguousCache.append(original); |
|
352 |
QCOMPARE(original.refCount(), 3); |
|
353 |
contiguousCache.removeFirst(); |
|
354 |
QCOMPARE(original.refCount(), 2); // shared null, 'original'. |
|
355 |
contiguousCache.append(original); |
|
356 |
QCOMPARE(original.refCount(), 3); |
|
357 |
contiguousCache.clear(); |
|
358 |
QCOMPARE(original.refCount(), 2); |
|
359 |
||
360 |
for(int i = 0; i < 100; ++i) |
|
361 |
contiguousCache.insert(i, original); |
|
362 |
||
363 |
QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. |
|
364 |
||
365 |
contiguousCache.clear(); |
|
366 |
QCOMPARE(original.refCount(), 2); |
|
367 |
for (int i = 0; i < 100; i++) |
|
368 |
contiguousCache.append(original); |
|
369 |
||
370 |
QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. |
|
371 |
contiguousCache.clear(); |
|
372 |
QCOMPARE(original.refCount(), 2); |
|
373 |
||
374 |
for (int i = 0; i < 100; i++) |
|
375 |
contiguousCache.prepend(original); |
|
376 |
||
377 |
QCOMPARE(original.refCount(), 12); // shared null, 'original', + 10 in contiguousCache. |
|
378 |
contiguousCache.clear(); |
|
379 |
QCOMPARE(original.refCount(), 2); |
|
380 |
||
381 |
for (int i = 0; i < 100; i++) |
|
382 |
contiguousCache.append(original); |
|
383 |
||
384 |
contiguousCache.takeLast(); |
|
385 |
QCOMPARE(original.refCount(), 11); |
|
386 |
||
387 |
contiguousCache.takeFirst(); |
|
388 |
QCOMPARE(original.refCount(), 10); |
|
389 |
} |
|
390 |
||
391 |
void tst_QContiguousCache::operatorAt() |
|
392 |
{ |
|
393 |
RefCountingClass original; |
|
394 |
QContiguousCache<RefCountingClass> contiguousCache(10); |
|
395 |
||
396 |
for (int i = 25; i < 35; ++i) |
|
397 |
contiguousCache[i] = original; |
|
398 |
||
399 |
QCOMPARE(original.refCount(), 12); // shared null, orig, items in cache |
|
400 |
||
401 |
// verify const access does not copy items. |
|
402 |
const QContiguousCache<RefCountingClass> copy(contiguousCache); |
|
403 |
for (int i = 25; i < 35; ++i) |
|
404 |
QCOMPARE(copy[i].refCount(), 12); |
|
405 |
||
406 |
// verify modifying the original increments ref count (e.g. does a detach) |
|
407 |
contiguousCache[25] = original; |
|
408 |
QCOMPARE(original.refCount(), 22); |
|
409 |
} |
|
410 |
||
411 |
/* |
|
412 |
Benchmarks must be near identical in tasks to be fair. |
|
413 |
QCache uses pointers to ints as its a requirement of QCache, |
|
414 |
whereas QContiguousCache doesn't support pointers (won't free them). |
|
415 |
Given the ability to use simple data types is a benefit, its |
|
416 |
fair. Although this obviously must take into account we are |
|
417 |
testing QContiguousCache use cases here, QCache has its own |
|
418 |
areas where it is the more sensible class to use. |
|
419 |
*/ |
|
420 |
void tst_QContiguousCache::cacheBenchmark() |
|
421 |
{ |
|
422 |
QBENCHMARK { |
|
423 |
QCache<int, int> cache; |
|
424 |
cache.setMaxCost(100); |
|
425 |
||
426 |
for (int i = 0; i < 1000; i++) |
|
427 |
cache.insert(i, new int(i)); |
|
428 |
} |
|
429 |
} |
|
430 |
||
431 |
void tst_QContiguousCache::contiguousCacheBenchmark() |
|
432 |
{ |
|
433 |
QBENCHMARK { |
|
434 |
QContiguousCache<int> contiguousCache(100); |
|
435 |
for (int i = 0; i < 1000; i++) |
|
436 |
contiguousCache.insert(i, i); |
|
437 |
} |
|
438 |
} |
|
439 |
||
440 |
void tst_QContiguousCache::setCapacity() |
|
441 |
{ |
|
442 |
int i; |
|
443 |
QContiguousCache<int> contiguousCache(100); |
|
444 |
for (i = 280; i < 310; ++i) |
|
445 |
contiguousCache.insert(i, i); |
|
446 |
QCOMPARE(contiguousCache.capacity(), 100); |
|
447 |
QCOMPARE(contiguousCache.count(), 30); |
|
448 |
QCOMPARE(contiguousCache.firstIndex(), 280); |
|
449 |
QCOMPARE(contiguousCache.lastIndex(), 309); |
|
450 |
||
451 |
for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { |
|
452 |
QVERIFY(contiguousCache.containsIndex(i)); |
|
453 |
QCOMPARE(contiguousCache.at(i), i); |
|
454 |
} |
|
455 |
||
456 |
contiguousCache.setCapacity(150); |
|
457 |
||
458 |
QCOMPARE(contiguousCache.capacity(), 150); |
|
459 |
QCOMPARE(contiguousCache.count(), 30); |
|
460 |
QCOMPARE(contiguousCache.firstIndex(), 280); |
|
461 |
QCOMPARE(contiguousCache.lastIndex(), 309); |
|
462 |
||
463 |
for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { |
|
464 |
QVERIFY(contiguousCache.containsIndex(i)); |
|
465 |
QCOMPARE(contiguousCache.at(i), i); |
|
466 |
} |
|
467 |
||
468 |
contiguousCache.setCapacity(20); |
|
469 |
||
470 |
QCOMPARE(contiguousCache.capacity(), 20); |
|
471 |
QCOMPARE(contiguousCache.count(), 20); |
|
472 |
QCOMPARE(contiguousCache.firstIndex(), 290); |
|
473 |
QCOMPARE(contiguousCache.lastIndex(), 309); |
|
474 |
||
475 |
for (i = contiguousCache.firstIndex(); i <= contiguousCache.lastIndex(); ++i) { |
|
476 |
QVERIFY(contiguousCache.containsIndex(i)); |
|
477 |
QCOMPARE(contiguousCache.at(i), i); |
|
478 |
} |
|
479 |
} |
|
480 |
||
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
481 |
void tst_QContiguousCache::zeroCapacity() |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
482 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
483 |
QContiguousCache<int> contiguousCache; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
484 |
QCOMPARE(contiguousCache.capacity(),0); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
485 |
contiguousCache.setCapacity(10); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
486 |
QCOMPARE(contiguousCache.capacity(),10); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
487 |
contiguousCache.setCapacity(0); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
488 |
QCOMPARE(contiguousCache.capacity(),0); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
489 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
490 |
|
0 | 491 |
#include "tst_qcontiguouscache.moc" |