1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/arrays/arrays.cpp
3 // Purpose: wxArray unit test
4 // Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
7 // Copyright: (c) 2004 Vadim Zeitlin, Wlodzimierz Skiba
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
24 #include "wx/dynarray.h"
26 // ----------------------------------------------------------------------------
27 // helpers for testing values and sizes
28 // ----------------------------------------------------------------------------
30 #define COMPARE_VALUE( array , index , value ) ( array.Item( index ) == value )
32 #define COMPARE_2_VALUES( array , p0 , p1 ) \
33 COMPARE_VALUE( array , 0 , p0 ) && \
34 COMPARE_VALUE( array , 1 , p1 )
36 #define COMPARE_3_VALUES( array , p0 , p1 , p2 ) \
37 COMPARE_2_VALUES( array , p0 , p1 ) && \
38 COMPARE_VALUE( array , 2 , p2 )
40 #define COMPARE_4_VALUES( array , p0 , p1 , p2 , p3 ) \
41 COMPARE_3_VALUES( array , p0 , p1 , p2 ) && \
42 COMPARE_VALUE( array , 3 , p3 )
44 #define COMPARE_5_VALUES( array , p0 , p1 , p2 , p3 , p4 ) \
45 COMPARE_4_VALUES( array , p0 , p1 , p2 , p3 ) && \
46 COMPARE_VALUE( array , 4 , p4 )
48 #define COMPARE_6_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 ) \
49 COMPARE_5_VALUES( array , p0 , p1 , p2 , p3 , p4 ) && \
50 COMPARE_VALUE( array , 5 , p5 )
52 #define COMPARE_7_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 ) \
53 COMPARE_6_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 ) && \
54 COMPARE_VALUE( array , 6 , p6 )
56 #define COMPARE_8_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 , p7 ) \
57 COMPARE_7_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 ) && \
58 COMPARE_VALUE( array , 7 , p7 )
60 #define COMPARE_9_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 ) \
61 COMPARE_8_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 , p7 ) && \
62 COMPARE_VALUE( array , 8 , p8 )
64 #define COMPARE_10_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 , p9 ) \
65 COMPARE_9_VALUES( array , p0 , p1 , p2 , p3 , p4 , p5 , p6 , p7 , p8 ) && \
66 COMPARE_VALUE( array , 9 , p9 )
68 #define COMPARE_COUNT( array , n ) \
69 ( array.GetCount() == n ) && \
70 ( array.Last() == array.Item( n - 1 ) )
72 // ----------------------------------------------------------------------------
73 // helpers for testing wxObjArray
74 // ----------------------------------------------------------------------------
79 Bar(const wxString
& name
) : m_name(name
) { ms_bars
++; }
80 Bar(const Bar
& bar
) : m_name(bar
.m_name
) { ms_bars
++; }
83 static size_t GetNumber() { return ms_bars
; }
85 const wxChar
*GetName() const { return m_name
.c_str(); }
90 static size_t ms_bars
;
93 size_t Bar::ms_bars
= 0;
95 WX_DECLARE_OBJARRAY(Bar
, ArrayBars
);
96 #include "wx/arrimpl.cpp"
97 WX_DEFINE_OBJARRAY(ArrayBars
)
99 // ----------------------------------------------------------------------------
100 // helpers for sorting arrays and comparing items
101 // ----------------------------------------------------------------------------
103 int wxCMPFUNC_CONV
StringLenCompare(const wxString
& first
,
104 const wxString
& second
)
106 return first
.length() - second
.length();
109 #define DEFINE_COMPARE(name, T) \
111 int wxCMPFUNC_CONV name ## CompareValues(T first, T second) \
113 return first - second; \
116 int wxCMPFUNC_CONV name ## Compare(T* first, T* second) \
118 return *first - *second; \
121 int wxCMPFUNC_CONV name ## RevCompare(T* first, T* second) \
123 return *second - *first; \
126 typedef unsigned short ushort;
128 DEFINE_COMPARE(Char
, char)
129 DEFINE_COMPARE(UShort
, ushort
)
130 DEFINE_COMPARE(Int
, int)
132 WX_DEFINE_ARRAY_CHAR(char, wxArrayChar
);
133 WX_DEFINE_SORTED_ARRAY_CHAR(char, wxSortedArrayCharNoCmp
);
134 WX_DEFINE_SORTED_ARRAY_CMP_CHAR(char, CharCompareValues
, wxSortedArrayChar
);
136 WX_DEFINE_ARRAY_SHORT(ushort
, wxArrayUShort
);
137 WX_DEFINE_SORTED_ARRAY_SHORT(ushort
, wxSortedArrayUShortNoCmp
);
138 WX_DEFINE_SORTED_ARRAY_CMP_SHORT(ushort
, UShortCompareValues
, wxSortedArrayUShort
);
140 WX_DEFINE_SORTED_ARRAY_CMP_INT(int, IntCompareValues
, wxSortedArrayInt
);
144 Item(int n_
= 0) : n(n_
) { }
149 WX_DEFINE_ARRAY_PTR(Item
*, ItemPtrArray
);
151 // ----------------------------------------------------------------------------
153 // ----------------------------------------------------------------------------
155 class ArraysTestCase
: public CppUnit::TestCase
161 CPPUNIT_TEST_SUITE( ArraysTestCase
);
162 CPPUNIT_TEST( wxStringArrayTest
);
163 CPPUNIT_TEST( wxStringArraySplitTest
);
164 CPPUNIT_TEST( wxStringArrayJoinTest
);
165 CPPUNIT_TEST( wxStringArraySplitJoinTest
);
167 CPPUNIT_TEST( wxObjArrayTest
);
168 CPPUNIT_TEST( wxArrayUShortTest
);
169 CPPUNIT_TEST( wxArrayIntTest
);
170 CPPUNIT_TEST( wxArrayCharTest
);
171 CPPUNIT_TEST( TestSTL
);
172 CPPUNIT_TEST( Alloc
);
173 CPPUNIT_TEST( Clear
);
174 CPPUNIT_TEST( Swap
);
175 CPPUNIT_TEST_SUITE_END();
177 void wxStringArrayTest();
178 void wxStringArraySplitTest();
179 void wxStringArrayJoinTest();
180 void wxStringArraySplitJoinTest();
181 void wxObjArrayTest();
182 void wxArrayUShortTest();
183 void wxArrayIntTest();
184 void wxArrayCharTest();
190 DECLARE_NO_COPY_CLASS(ArraysTestCase
)
193 // register in the unnamed registry so that these tests are run by default
194 CPPUNIT_TEST_SUITE_REGISTRATION( ArraysTestCase
);
196 // also include in it's own registry so that these tests can be run alone
197 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ArraysTestCase
, "ArraysTestCase" );
199 void ArraysTestCase::wxStringArrayTest()
202 a1
.Add(_T("thermit"));
203 a1
.Add(_T("condor"));
204 a1
.Add(_T("lion"), 3);
207 a1
.Add(_T("alligator"));
209 CPPUNIT_ASSERT( COMPARE_8_VALUES( a1
, _T("thermit") ,
217 CPPUNIT_ASSERT( COMPARE_COUNT( a1
, 8 ) );
219 wxArrayString
a2(a1
);
221 CPPUNIT_ASSERT( COMPARE_8_VALUES( a2
, _T("thermit") ,
229 CPPUNIT_ASSERT( COMPARE_COUNT( a2
, 8 ) );
231 wxSortedArrayString
a3(a1
);
233 CPPUNIT_ASSERT( COMPARE_8_VALUES( a3
, _T("alligator") ,
241 CPPUNIT_ASSERT( COMPARE_COUNT( a3
, 8 ) );
243 wxSortedArrayString a4
;
244 for (wxArrayString::iterator it
= a1
.begin(), en
= a1
.end(); it
!= en
; ++it
)
247 CPPUNIT_ASSERT( COMPARE_8_VALUES( a4
, _T("alligator") ,
255 CPPUNIT_ASSERT( COMPARE_COUNT( a4
, 8 ) );
259 CPPUNIT_ASSERT( COMPARE_5_VALUES( a1
, _T("thermit") ,
264 CPPUNIT_ASSERT( COMPARE_COUNT( a1
, 5 ) );
268 CPPUNIT_ASSERT( COMPARE_5_VALUES( a2
, _T("thermit") ,
273 CPPUNIT_ASSERT( COMPARE_COUNT( a2
, 5 ) );
277 CPPUNIT_ASSERT( COMPARE_5_VALUES( a1
, _T("alligator") ,
282 CPPUNIT_ASSERT( COMPARE_COUNT( a1
, 5 ) );
286 CPPUNIT_ASSERT( COMPARE_5_VALUES( a1
, _T("thermit") ,
291 CPPUNIT_ASSERT( COMPARE_COUNT( a1
, 5 ) );
293 a1
.Sort(&StringLenCompare
);
295 CPPUNIT_ASSERT( COMPARE_5_VALUES( a1
, _T("dog") ,
300 CPPUNIT_ASSERT( COMPARE_COUNT( a1
, 5 ) );
301 CPPUNIT_ASSERT( a1
.Index( _T("dog") ) == 0 );
302 CPPUNIT_ASSERT( a1
.Index( _T("human") ) == 1 );
303 CPPUNIT_ASSERT( a1
.Index( _T("humann") ) == wxNOT_FOUND
);
304 CPPUNIT_ASSERT( a1
.Index( _T("condor") ) == 2 );
305 CPPUNIT_ASSERT( a1
.Index( _T("thermit") ) == 3 );
306 CPPUNIT_ASSERT( a1
.Index( _T("alligator") ) == 4 );
310 CPPUNIT_ASSERT( a5
.Add( _T("x"), 1 ) == 0 );
311 CPPUNIT_ASSERT( a5
.Add( _T("a"), 3 ) == 1 );
313 CPPUNIT_ASSERT( COMPARE_4_VALUES( a5
, _T("x") ,
318 a5
.assign(a1
.end(), a1
.end());
319 CPPUNIT_ASSERT( a5
.empty() );
321 a5
.assign(a1
.begin(), a1
.end());
322 CPPUNIT_ASSERT( a5
== a1
);
324 #ifdef wxHAS_VECTOR_TEMPLATE_ASSIGN
325 const wxString months
[] = { "Jan", "Feb", "Mar" };
326 a5
.assign(months
, months
+ WXSIZEOF(months
));
327 CPPUNIT_ASSERT_EQUAL( WXSIZEOF(months
), a5
.size() );
328 CPPUNIT_ASSERT( COMPARE_3_VALUES(a5
, "Jan", "Feb", "Mar") );
329 #endif // wxHAS_VECTOR_TEMPLATE_ASSIGN
332 void ArraysTestCase::wxStringArraySplitTest()
337 wxString str
= wxT(",,,,first,second,third,,");
338 const wxChar
*expected
[] =
339 { wxT(""), wxT(""), wxT(""), wxT(""), wxT("first"),
340 wxT("second"), wxT("third"), wxT(""), wxT("") };
342 wxArrayString
exparr(WXSIZEOF(expected
), expected
);
343 wxArrayString
realarr(wxSplit(str
, wxT(',')));
344 CPPUNIT_ASSERT( exparr
== realarr
);
348 wxString str
= wxT(",\\,first,second,third,");
349 const wxChar
*expected
[] =
350 { wxT(""), wxT(",first"), wxT("second"), wxT("third"), wxT("") };
351 const wxChar
*expected2
[] =
352 { wxT(""), wxT("\\"), wxT("first"), wxT("second"), wxT("third"), wxT("") };
355 wxArrayString
exparr(WXSIZEOF(expected
), expected
);
356 wxArrayString
realarr(wxSplit(str
, wxT(','), wxT('\\')));
357 CPPUNIT_ASSERT( exparr
== realarr
);
359 // escaping turned off:
360 wxArrayString
exparr2(WXSIZEOF(expected2
), expected2
);
361 wxArrayString
realarr2(wxSplit(str
, wxT(','), wxT('\0')));
362 CPPUNIT_ASSERT( exparr2
== realarr2
);
366 // test is escape characters placed before non-separator character are
367 // just ignored as they should:
368 wxString str
= wxT(",\\,,fir\\st,se\\cond\\,,\\third");
369 const wxChar
*expected
[] =
370 { wxT(""), wxT(","), wxT("fir\\st"), wxT("se\\cond,"), wxT("\\third") };
371 const wxChar
*expected2
[] =
372 { wxT(""), wxT("\\"), wxT(""), wxT("fir\\st"), wxT("se\\cond\\"),
373 wxT(""), wxT("\\third") };
376 wxArrayString
exparr(WXSIZEOF(expected
), expected
);
377 wxArrayString
realarr(wxSplit(str
, wxT(','), wxT('\\')));
378 CPPUNIT_ASSERT( exparr
== realarr
);
380 // escaping turned off:
381 wxArrayString
exparr2(WXSIZEOF(expected2
), expected2
);
382 wxArrayString
realarr2(wxSplit(str
, wxT(','), wxT('\0')));
383 CPPUNIT_ASSERT( exparr2
== realarr2
);
387 void ArraysTestCase::wxStringArrayJoinTest()
392 const wxChar
*arr
[] = { wxT("first"), wxT(""), wxT("second"), wxT("third") };
393 wxString expected
= wxT("first,,second,third");
395 wxArrayString
arrstr(WXSIZEOF(arr
), arr
);
396 wxString result
= wxJoin(arrstr
, wxT(','));
397 CPPUNIT_ASSERT( expected
== result
);
401 const wxChar
*arr
[] = { wxT("first, word"), wxT(",,second"), wxT("third,,") };
402 wxString expected
= wxT("first\\, word,\\,\\,second,third\\,\\,");
403 wxString expected2
= wxT("first, word,,,second,third,,");
406 wxArrayString
arrstr(WXSIZEOF(arr
), arr
);
407 wxString result
= wxJoin(arrstr
, wxT(','), wxT('\\'));
408 CPPUNIT_ASSERT( expected
== result
);
410 // escaping turned off:
411 wxString result2
= wxJoin(arrstr
, wxT(','), wxT('\0'));
412 CPPUNIT_ASSERT( expected2
== result2
);
416 // test is escape characters placed in the original array are just ignored as they should:
417 const wxChar
*arr
[] = { wxT("first\\, wo\\rd"), wxT("seco\\nd"), wxT("\\third\\") };
418 wxString expected
= wxT("first\\\\, wo\\rd,seco\\nd,\\third\\");
419 wxString expected2
= wxT("first\\, wo\\rd,seco\\nd,\\third\\");
422 wxArrayString
arrstr(WXSIZEOF(arr
), arr
);
423 wxString result
= wxJoin(arrstr
, wxT(','), wxT('\\'));
424 CPPUNIT_ASSERT( expected
== result
);
426 // escaping turned off:
427 wxString result2
= wxJoin(arrstr
, wxT(','), wxT('\0'));
428 CPPUNIT_ASSERT( expected2
== result2
);
432 void ArraysTestCase::wxStringArraySplitJoinTest()
434 wxChar separators
[] = { wxT('a'), wxT(','), wxT('_'), wxT(' '), wxT('\\'),
435 wxT('&'), wxT('{'), wxT('A'), wxT('<'), wxT('>'),
436 wxT('\''), wxT('\n'), wxT('!'), wxT('-') };
438 // test with a string: split it and then rejoin it:
440 wxString str
= wxT("This is a long, long test; if wxSplit and wxJoin do work ")
441 wxT("correctly, then splitting and joining this 'text' _multiple_ ")
442 wxT("times shouldn't cause any loss of content.\n")
443 wxT("This is some latex code: ")
444 wxT("\\func{wxString}{wxJoin}{")
445 wxT("\\param{const wxArray String\\&}{ arr}, ")
446 wxT("\\param{const wxChar}{ sep}, ")
447 wxT("\\param{const wxChar}{ escape = '\\'}}.\n")
448 wxT("This is some HTML code: ")
449 wxT("<html><head><meta http-equiv=\"content-type\">")
450 wxT("<title>Initial page of Mozilla Firefox</title>")
451 wxT("</meta></head></html>");
454 for (i
= 0; i
< WXSIZEOF(separators
); i
++)
456 wxArrayString arr
= wxSplit(str
, separators
[i
]);
457 CPPUNIT_ASSERT( str
== wxJoin(arr
, separators
[i
]) );
461 // test with an array: join it and then resplit it:
463 const wxChar
*arr
[] =
465 wxT("first, second!"), wxT("this is the third!!"),
466 wxT("\nThat's the fourth token\n\n"), wxT(" - fifth\ndummy\ntoken - "),
467 wxT("_sixth__token__with_underscores"), wxT("The! Last! One!")
469 wxArrayString
theArr(WXSIZEOF(arr
), arr
);
471 for (i
= 0; i
< WXSIZEOF(separators
); i
++)
473 wxString string
= wxJoin(theArr
, separators
[i
]);
474 CPPUNIT_ASSERT( theArr
== wxSplit(string
, separators
[i
]) );
477 wxArrayString emptyArray
;
478 wxString string
= wxJoin(emptyArray
, _T(';'));
479 CPPUNIT_ASSERT( string
.empty() );
481 CPPUNIT_ASSERT( wxSplit(string
, _T(';')).empty() );
483 CPPUNIT_ASSERT_EQUAL( 2, wxSplit(_T(";"), _T(';')).size() );
486 void ArraysTestCase::wxObjArrayTest()
490 Bar
bar(_T("first bar in general, second bar in array (two copies!)"));
492 CPPUNIT_ASSERT_EQUAL( 0, bars
.GetCount() );
493 CPPUNIT_ASSERT_EQUAL( 1, Bar::GetNumber() );
495 bars
.Add(new Bar(_T("first bar in array")));
498 CPPUNIT_ASSERT_EQUAL( 3, bars
.GetCount() );
499 CPPUNIT_ASSERT_EQUAL( 4, Bar::GetNumber() );
501 bars
.RemoveAt(1, bars
.GetCount() - 1);
503 CPPUNIT_ASSERT_EQUAL( 1, bars
.GetCount() );
504 CPPUNIT_ASSERT_EQUAL( 2, Bar::GetNumber() );
508 CPPUNIT_ASSERT_EQUAL( 0, bars
.GetCount() );
509 CPPUNIT_ASSERT_EQUAL( 1, Bar::GetNumber() );
511 CPPUNIT_ASSERT_EQUAL( 0, Bar::GetNumber() );
514 #define TestArrayOf(name) \
516 void ArraysTestCase::wxArray ## name ## Test() \
524 CPPUNIT_ASSERT( COMPARE_10_VALUES(a,1,17,17,5,5,5,3,3,3,3) ); \
525 CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \
527 a.Sort(name ## Compare); \
529 CPPUNIT_ASSERT( COMPARE_10_VALUES(a,1,3,3,3,3,5,5,5,17,17) ); \
530 CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \
532 a.Sort(name ## RevCompare); \
534 CPPUNIT_ASSERT( COMPARE_10_VALUES(a,17,17,5,5,5,3,3,3,3,1) ); \
535 CPPUNIT_ASSERT( COMPARE_COUNT( a , 10 ) ); \
537 wxSortedArray##name b; \
544 CPPUNIT_ASSERT( COMPARE_4_VALUES(b,1,3,5,17) ); \
545 CPPUNIT_ASSERT( COMPARE_COUNT( b , 4 ) ); \
546 CPPUNIT_ASSERT( b.Index( 0 ) == wxNOT_FOUND ); \
547 CPPUNIT_ASSERT( b.Index( 1 ) == 0 ); \
548 CPPUNIT_ASSERT( b.Index( 3 ) == 1 ); \
549 CPPUNIT_ASSERT( b.Index( 4 ) == wxNOT_FOUND ); \
550 CPPUNIT_ASSERT( b.Index( 5 ) == 2 ); \
551 CPPUNIT_ASSERT( b.Index( 6 ) == wxNOT_FOUND ); \
552 CPPUNIT_ASSERT( b.Index( 17 ) == 3 ); \
561 void ArraysTestCase::Alloc()
566 CPPUNIT_ASSERT_EQUAL( 2, a
.GetCount() );
570 CPPUNIT_ASSERT_EQUAL( 2, a
.GetCount() );
571 CPPUNIT_ASSERT_EQUAL( 17, a
[0] );
572 CPPUNIT_ASSERT_EQUAL( 9, a
[1] );
575 void ArraysTestCase::Clear()
579 WX_CLEAR_ARRAY(items
);
580 CPPUNIT_ASSERT_EQUAL( 0, items
.size() );
582 items
.push_back(new Item(17));
583 items
.push_back(new Item(71));
584 CPPUNIT_ASSERT_EQUAL( 2, items
.size() );
586 WX_CLEAR_ARRAY(items
);
587 CPPUNIT_ASSERT_EQUAL( 0, items
.size() );
593 template <typename A
, typename T
>
594 void DoTestSwap(T v1
, T v2
, T v3
,
595 A
* WXUNUSED(dummyUglyVC6Workaround
))
599 CPPUNIT_ASSERT( a1
.empty() && a2
.empty() );
603 CPPUNIT_ASSERT( a1
.empty() );
604 CPPUNIT_ASSERT_EQUAL( 1, a2
.size() );
609 CPPUNIT_ASSERT_EQUAL( 1, a1
.size() );
610 CPPUNIT_ASSERT_EQUAL( 2, a2
.size() );
611 CPPUNIT_ASSERT_EQUAL( v1
, a1
[0] );
612 CPPUNIT_ASSERT_EQUAL( v3
, a2
[1] );
615 CPPUNIT_ASSERT_EQUAL( 2, a1
.size() );
616 CPPUNIT_ASSERT_EQUAL( 1, a2
.size() );
619 } // anonymous namespace
621 void ArraysTestCase::Swap()
623 DoTestSwap("Foo", "Bar", "Baz", (wxArrayString
*)NULL
);
625 DoTestSwap(1, 10, 100, (wxArrayInt
*)NULL
);
626 DoTestSwap(6, 28, 496, (wxArrayLong
*)NULL
);
629 void ArraysTestCase::TestSTL()
632 wxArrayInt::iterator it
, en
;
633 wxArrayInt::reverse_iterator rit
, ren
;
635 static const int COUNT
= 5;
637 for ( i
= 0; i
< COUNT
; ++i
)
640 CPPUNIT_ASSERT( list1
.capacity() >= (size_t)COUNT
);
641 CPPUNIT_ASSERT_EQUAL( COUNT
, list1
.size() );
643 for ( it
= list1
.begin(), en
= list1
.end(), i
= 0;
644 it
!= en
; ++it
, ++i
)
646 CPPUNIT_ASSERT( *it
== i
);
649 CPPUNIT_ASSERT_EQUAL( COUNT
, i
);
651 for ( rit
= list1
.rbegin(), ren
= list1
.rend(), i
= COUNT
;
652 rit
!= ren
; ++rit
, --i
)
654 CPPUNIT_ASSERT( *rit
== i
-1 );
657 CPPUNIT_ASSERT_EQUAL( 0, i
);
659 CPPUNIT_ASSERT( *list1
.rbegin() == *(list1
.end()-1) &&
660 *list1
.begin() == *(list1
.rend()-1) );
662 it
= list1
.begin()+1;
663 rit
= list1
.rbegin()+1;
664 CPPUNIT_ASSERT( *list1
.begin() == *(it
-1) &&
665 *list1
.rbegin() == *(rit
-1) );
667 CPPUNIT_ASSERT( ( list1
.front() == 0 ) && ( list1
.back() == COUNT
- 1 ) );
669 list1
.erase(list1
.begin());
670 list1
.erase(list1
.end()-1);
672 for ( it
= list1
.begin(), en
= list1
.end(), i
= 1;
673 it
!= en
; ++it
, ++i
)
675 CPPUNIT_ASSERT( *it
== i
);
680 items
.push_back(new Item(17));
681 CPPUNIT_ASSERT_EQUAL( 17, (*(items
.rbegin()))->n
);
682 CPPUNIT_ASSERT_EQUAL( 17, (**items
.begin()).n
);