1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/strings/strings.cpp
3 // Purpose: wxString unit test
4 // Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
7 // Copyright: (c) 2004 Vadim Zeitlin, Wlodzimierz Skiba
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
24 #include "wx/tokenzr.h"
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
30 class StringTestCase
: public CppUnit::TestCase
36 CPPUNIT_TEST_SUITE( StringTestCase
);
37 CPPUNIT_TEST( String
);
38 CPPUNIT_TEST( PChar
);
39 CPPUNIT_TEST( Format
);
40 CPPUNIT_TEST( Constructors
);
42 CPPUNIT_TEST( ConstructorsWithConversion
);
43 CPPUNIT_TEST( Conversion
);
44 CPPUNIT_TEST( ConversionUTF7
);
45 CPPUNIT_TEST( ConversionUTF8
);
46 #endif // wxUSE_WCHAR_T
47 CPPUNIT_TEST( Extraction
);
49 CPPUNIT_TEST( Tokenizer
);
50 CPPUNIT_TEST( TokenizerGetPosition
);
51 CPPUNIT_TEST( Replace
);
52 CPPUNIT_TEST( Match
);
53 CPPUNIT_TEST( CaseChanges
);
54 CPPUNIT_TEST( Compare
);
55 CPPUNIT_TEST( CompareNoCase
);
56 CPPUNIT_TEST( ToLong
);
57 CPPUNIT_TEST( ToULong
);
58 CPPUNIT_TEST( ToDouble
);
59 CPPUNIT_TEST_SUITE_END();
66 void ConstructorsWithConversion();
68 void ConversionUTF7();
69 void ConversionUTF8();
70 #endif // wxUSE_WCHAR_T
73 void SingleTokenizerTest( wxChar
*str
, wxChar
*delims
, size_t count
, wxStringTokenizerMode mode
);
75 void TokenizerGetPosition();
86 // test if converting s using the given encoding gives ws and vice versa
88 // if either of the first 2 arguments is NULL, the conversion is supposed
90 void DoTestConversion(const char *s
, const wchar_t *w
, wxCSConv
& conv
);
91 #endif // wxUSE_WCHAR_T
93 DECLARE_NO_COPY_CLASS(StringTestCase
)
96 // register in the unnamed registry so that these tests are run by default
97 CPPUNIT_TEST_SUITE_REGISTRATION( StringTestCase
);
99 // also include in it's own registry so that these tests can be run alone
100 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( StringTestCase
, "StringTestCase" );
102 StringTestCase::StringTestCase()
106 void StringTestCase::String()
114 for (int i
= 0; i
< 2; ++i
)
118 c
= _T("! How'ya doin'?");
121 c
= _T("Hello world! What's up?");
122 CPPUNIT_ASSERT( c
!= a
);
126 void StringTestCase::PChar()
132 for (int i
= 0; i
< 2; ++i
)
134 wxStrcpy (a
, _T("Hello"));
135 wxStrcpy (b
, _T(" world"));
136 wxStrcpy (c
, _T("! How'ya doin'?"));
139 wxStrcpy (c
, _T("Hello world! What's up?"));
140 CPPUNIT_ASSERT( wxStrcmp (c
, a
) != 0 );
144 void StringTestCase::Format()
147 s1
.Printf(_T("%03d"), 18);
148 CPPUNIT_ASSERT( s1
== wxString::Format(_T("%03d"), 18) );
149 s2
.Printf(_T("Number 18: %s\n"), s1
.c_str());
150 CPPUNIT_ASSERT( s2
== wxString::Format(_T("Number 18: %s\n"), s1
.c_str()) );
153 void StringTestCase::Constructors()
155 #define TEST_CTOR(args, res) \
158 CPPUNIT_ASSERT( s == res ); \
161 TEST_CTOR((_T('Z'), 4), _T("ZZZZ"));
162 TEST_CTOR((_T("Hello"), 4), _T("Hell"));
163 TEST_CTOR((_T("Hello"), 5), _T("Hello"));
165 static const wxChar
*s
= _T("?really!");
166 const wxChar
*start
= wxStrchr(s
, _T('r'));
167 const wxChar
*end
= wxStrchr(s
, _T('!'));
168 TEST_CTOR((start
, end
), _T("really"));
172 void StringTestCase::ConstructorsWithConversion()
174 // the string "Déjà" in UTF-8 and wchar_t:
175 const unsigned char utf8Buf
[] = {0x44,0xC3,0xA9,0x6A,0xC3,0xA0,0};
176 const wchar_t wchar
[] = {0x44,0xE9,0x6A,0xE0,0};
177 const unsigned char utf8subBuf
[] = {0x44,0xC3,0xA9,0x6A,0}; // just "Déj"
178 const char *utf8
= (char *)utf8Buf
;
179 const char *utf8sub
= (char *)utf8subBuf
;
181 wxString
s1(utf8
, wxConvUTF8
);
182 wxString
s2(wchar
, wxConvUTF8
);
185 CPPUNIT_ASSERT( s1
== wchar
);
186 CPPUNIT_ASSERT( s2
== wchar
);
188 CPPUNIT_ASSERT( s1
== utf8
);
189 CPPUNIT_ASSERT( s2
== utf8
);
192 wxString
sub(utf8sub
, wxConvUTF8
); // "Dej" substring
193 wxString
s3(utf8
, wxConvUTF8
, 4);
194 wxString
s4(wchar
, wxConvUTF8
, 3);
196 CPPUNIT_ASSERT( s3
== sub
);
197 CPPUNIT_ASSERT( s4
== sub
);
200 CPPUNIT_ASSERT ( wxString("\t[pl]open.format.Sformatuj dyskietkê=gfloppy %f",
201 wxConvUTF8
) == wxT("") ); //should stop at pos 35
205 void StringTestCase::Conversion()
208 wxString
szTheString(L
"The\0String", wxConvLibc
, 10);
209 wxCharBuffer theBuffer
= szTheString
.mb_str();
211 CPPUNIT_ASSERT( memcmp(theBuffer
.data(), "The\0String", 11) == 0 );
213 wxString
szTheString2("The\0String", wxConvLocal
, 10);
214 CPPUNIT_ASSERT( szTheString2
.length() == 11 );
215 CPPUNIT_ASSERT( wxTmemcmp(szTheString2
.c_str(), L
"The\0String", 11) == 0 );
217 wxString
szTheString(wxT("TheString"));
218 szTheString
.insert(3, 1, '\0');
219 wxWCharBuffer theBuffer
= szTheString
.wc_str(wxConvLibc
);
221 CPPUNIT_ASSERT( memcmp(theBuffer
.data(), L
"The\0String", 11 * sizeof(wchar_t)) == 0 );
223 wxString
szLocalTheString(wxT("TheString"));
224 szLocalTheString
.insert(3, 1, '\0');
225 wxWCharBuffer theLocalBuffer
= szLocalTheString
.wc_str(wxConvLocal
);
227 CPPUNIT_ASSERT( memcmp(theLocalBuffer
.data(), L
"The\0String", 11 * sizeof(wchar_t)) == 0 );
231 // in case wcscmp is missing
233 static int wx_wcscmp(const wchar_t *s1
, const wchar_t *s2
)
247 StringTestCase::DoTestConversion(const char *s
,
254 wxCharBuffer
buf(wxString(ws
).mb_str(conv
));
256 CPPUNIT_ASSERT( strcmp(buf
, s
) == 0 );
258 #else // wxUSE_UNICODE
261 wxWCharBuffer
wbuf(wxString(s
).wc_str(conv
));
264 CPPUNIT_ASSERT( wx_wcscmp(wbuf
, ws
) == 0 );
266 CPPUNIT_ASSERT( !*wbuf
);
268 #endif // wxUSE_UNICODE/!wxUSE_UNICODE
271 struct StringConversionData
277 void StringTestCase::ConversionUTF7()
279 static const StringConversionData utf7data
[] =
283 //\u isn't recognized on MSVC 6
284 #if !defined(_MSC_VER)
285 #if !defined(__GNUC__) || (__GNUC__ >= 3)
286 { "+AKM-", L
"\u00a3" },
289 // Windows accepts invalid UTF-7 strings and so does our UTF-7
290 // conversion code -- this is wrong IMO but the way it is for now
292 // notice that converting "+" still behaves as expected because the
293 // result is just an empty string, i.e. the same as if there were an
294 // error, but converting "a+" results in "a" while it really should
300 wxCSConv
conv(_T("utf-7"));
301 for ( size_t n
= 0; n
< WXSIZEOF(utf7data
); n
++ )
303 const StringConversionData
& d
= utf7data
[n
];
304 DoTestConversion(d
.str
, d
.wcs
, conv
);
308 void StringTestCase::ConversionUTF8()
310 static const StringConversionData utf8data
[] =
312 //\u isn't recognized on MSVC 6
313 #if !defined(_MSC_VER)
314 #if !defined(__GNUC__) || (__GNUC__ >= 3)
315 { "\xc2\xa3", L
"\u00a3" },
321 wxCSConv
conv(_T("utf-8"));
322 for ( size_t n
= 0; n
< WXSIZEOF(utf8data
); n
++ )
324 const StringConversionData
& d
= utf8data
[n
];
325 DoTestConversion(d
.str
, d
.wcs
, conv
);
329 #endif // wxUSE_WCHAR_T
332 void StringTestCase::Extraction()
334 wxString
s(_T("Hello, world!"));
336 CPPUNIT_ASSERT( wxStrcmp( s
.c_str() , _T("Hello, world!") ) == 0 );
337 CPPUNIT_ASSERT( wxStrcmp( s
.Left(5).c_str() , _T("Hello") ) == 0 );
338 CPPUNIT_ASSERT( wxStrcmp( s
.Right(6).c_str() , _T("world!") ) == 0 );
339 CPPUNIT_ASSERT( wxStrcmp( s(3, 5).c_str() , _T("lo, w") ) == 0 );
340 CPPUNIT_ASSERT( wxStrcmp( s
.Mid(3).c_str() , _T("lo, world!") ) == 0 );
341 CPPUNIT_ASSERT( wxStrcmp( s
.substr(3, 5).c_str() , _T("lo, w") ) == 0 );
342 CPPUNIT_ASSERT( wxStrcmp( s
.substr(3).c_str() , _T("lo, world!") ) == 0 );
346 #define TEST_STARTS_WITH( prefix , correct_rest, result ) \
348 ( s.StartsWith( prefix, &rest ) == result ) && \
349 ( ( result == false ) || ( wxStrcmp( correct_rest , rest ) == 0 ) ) \
352 TEST_STARTS_WITH( _T("Hello"), _T(", world!"), true );
353 TEST_STARTS_WITH( _T("Hello, "), _T("world!"), true );
354 TEST_STARTS_WITH( _T("Hello, world!"), _T(""), true );
355 TEST_STARTS_WITH( _T("Hello, world!!!"), _T(""), false );
356 TEST_STARTS_WITH( _T(""), _T("Hello, world!"), true );
357 TEST_STARTS_WITH( _T("Goodbye"), _T(""), false );
358 TEST_STARTS_WITH( _T("Hi"), _T(""), false );
360 #undef TEST_STARTS_WITH
363 void StringTestCase::Find()
365 #define TEST_FIND( str , start , result ) \
366 CPPUNIT_ASSERT( wxString(str).find(_T("ell"), start) == result );
368 TEST_FIND( _T("Well, hello world"), 0, 1 );
369 TEST_FIND( _T("Well, hello world"), 6, 7 );
370 TEST_FIND( _T("Well, hello world"), 9, wxString::npos
);
375 void StringTestCase::SingleTokenizerTest( wxChar
*str
, wxChar
*delims
, size_t count
, wxStringTokenizerMode mode
)
377 wxStringTokenizer
tkz( str
, delims
, mode
);
378 CPPUNIT_ASSERT( tkz
.CountTokens() == count
);
380 wxChar
*buf
, *s
= NULL
, *last
;
382 if ( tkz
.GetMode() == wxTOKEN_STRTOK
)
384 buf
= new wxChar
[wxStrlen(str
) + 1];
386 s
= wxStrtok(buf
, delims
, &last
);
394 while ( tkz
.HasMoreTokens() )
396 wxString token
= tkz
.GetNextToken();
399 CPPUNIT_ASSERT( token
== s
);
400 s
= wxStrtok(NULL
, delims
, &last
);
405 CPPUNIT_ASSERT( count2
== count
);
412 void StringTestCase::Tokenizer()
414 SingleTokenizerTest( _T(""), _T(" "), 0, wxTOKEN_DEFAULT
);
415 SingleTokenizerTest( _T("Hello, world"), _T(" "), 2, wxTOKEN_DEFAULT
);
416 SingleTokenizerTest( _T("Hello, world "), _T(" "), 2, wxTOKEN_DEFAULT
);
417 SingleTokenizerTest( _T("Hello, world"), _T(","), 2, wxTOKEN_DEFAULT
);
418 SingleTokenizerTest( _T("Hello, world!"), _T(",!"), 2, wxTOKEN_DEFAULT
);
419 SingleTokenizerTest( _T("Hello,, world!"), _T(",!"), 3, wxTOKEN_DEFAULT
);
420 SingleTokenizerTest( _T("Hello, world!"), _T(",!"), 3, wxTOKEN_RET_EMPTY_ALL
);
421 SingleTokenizerTest( _T("username:password:uid:gid:gecos:home:shell"), _T(":"), 7, wxTOKEN_DEFAULT
);
422 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 4, wxTOKEN_DEFAULT
);
423 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 6, wxTOKEN_RET_EMPTY
);
424 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 9, wxTOKEN_RET_EMPTY_ALL
);
425 SingleTokenizerTest( _T("01/02/99"), _T("/-"), 3, wxTOKEN_DEFAULT
);
426 SingleTokenizerTest( _T("01-02/99"), _T("/-"), 3, wxTOKEN_RET_DELIMS
);
429 // call this with the string to tokenize, delimeters to use and the expected
430 // positions (i.e. results of GetPosition()) after each GetNextToken() call,
431 // terminate positions with 0
432 static void DoTokenizerGetPosition(const wxChar
*s
,
433 const wxChar
*delims
, int pos
, ...)
435 wxStringTokenizer
tkz(s
, delims
);
437 CPPUNIT_ASSERT( tkz
.GetPosition() == 0 );
446 CPPUNIT_ASSERT( !tkz
.HasMoreTokens() );
452 CPPUNIT_ASSERT( tkz
.GetPosition() == (size_t)pos
);
454 pos
= va_arg(ap
, int);
460 void StringTestCase::TokenizerGetPosition()
462 DoTokenizerGetPosition(_T("foo"), _T("_"), 3, 0);
463 DoTokenizerGetPosition(_T("foo_bar"), _T("_"), 4, 7, 0);
464 DoTokenizerGetPosition(_T("foo_bar_"), _T("_"), 4, 8, 0);
467 void StringTestCase::Replace()
469 #define TEST_REPLACE( original , pos , len , replacement , result ) \
471 wxString s = original; \
472 s.replace( pos , len , replacement ); \
473 CPPUNIT_ASSERT( s == result ); \
476 TEST_REPLACE( _T("012-AWORD-XYZ"), 4, 5, _T("BWORD"), _T("012-BWORD-XYZ") );
477 TEST_REPLACE( _T("increase"), 0, 2, _T("de"), _T("decrease") );
478 TEST_REPLACE( _T("wxWindow"), 8, 0, _T("s"), _T("wxWindows") );
479 TEST_REPLACE( _T("foobar"), 3, 0, _T("-"), _T("foo-bar") );
480 TEST_REPLACE( _T("barfoo"), 0, 6, _T("foobar"), _T("foobar") );
483 #define TEST_NULLCHARREPLACE( o , olen, pos , len , replacement , r, rlen ) \
485 wxString s(o,olen); \
486 s.replace( pos , len , replacement ); \
487 CPPUNIT_ASSERT( s == wxString(r,rlen) ); \
490 TEST_NULLCHARREPLACE( _T("null\0char"), 9, 5, 1, _T("d"),
491 _T("null\0dhar"), 9 );
493 #define TEST_WXREPLACE( o , olen, olds, news, all, r, rlen ) \
495 wxString s(o,olen); \
496 s.Replace( olds, news, all ); \
497 CPPUNIT_ASSERT( s == wxString(r,rlen) ); \
500 TEST_WXREPLACE( _T("null\0char"), 9, _T("c"), _T("de"), true,
501 _T("null\0dehar"), 10 );
503 TEST_WXREPLACE( _T("null\0dehar"), 10, _T("de"), _T("c"), true,
504 _T("null\0char"), 9 );
506 #undef TEST_WXREPLACE
507 #undef TEST_NULLCHARREPLACE
511 void StringTestCase::Match()
513 #define TEST_MATCH( s1 , s2 , result ) \
514 CPPUNIT_ASSERT( wxString(s1).Matches(s2) == result )
516 TEST_MATCH( _T("foobar"), _T("foo*"), true );
517 TEST_MATCH( _T("foobar"), _T("*oo*"), true );
518 TEST_MATCH( _T("foobar"), _T("*bar"), true );
519 TEST_MATCH( _T("foobar"), _T("??????"), true );
520 TEST_MATCH( _T("foobar"), _T("f??b*"), true );
521 TEST_MATCH( _T("foobar"), _T("f?b*"), false );
522 TEST_MATCH( _T("foobar"), _T("*goo*"), false );
523 TEST_MATCH( _T("foobar"), _T("*foo"), false );
524 TEST_MATCH( _T("foobarfoo"), _T("*foo"), true );
525 TEST_MATCH( _T(""), _T("*"), true );
526 TEST_MATCH( _T(""), _T("?"), false );
532 void StringTestCase::CaseChanges()
534 wxString
s1(_T("Hello!"));
543 CPPUNIT_ASSERT( s1u
== _T("HELLO!") );
544 CPPUNIT_ASSERT( s1l
== _T("hello!") );
545 CPPUNIT_ASSERT( s2u
== wxEmptyString
);
546 CPPUNIT_ASSERT( s2l
== wxEmptyString
);
549 wxLocale
locRu(wxLANGUAGE_RUSSIAN
, 0 /* flags */);
552 // try upper casing 8bit strings
553 wxString
sUpper("\xdf"),
556 CPPUNIT_ASSERT( sUpper
.Lower() == sLower
);
557 CPPUNIT_ASSERT( sLower
.Upper() == sUpper
);
559 #endif // !wxUSE_UNICODE
562 void StringTestCase::Compare()
564 wxString s1
= wxT("AHH");
565 wxString eq
= wxT("AHH");
566 wxString neq1
= wxT("HAH");
567 wxString neq2
= wxT("AH");
568 wxString neq3
= wxT("AHHH");
569 wxString neq4
= wxT("AhH");
571 CPPUNIT_ASSERT( s1
== eq
);
572 CPPUNIT_ASSERT( s1
!= neq1
);
573 CPPUNIT_ASSERT( s1
!= neq2
);
574 CPPUNIT_ASSERT( s1
!= neq3
);
575 CPPUNIT_ASSERT( s1
!= neq4
);
577 // wxString _s1 = wxT("A\0HH");
578 // wxString _eq = wxT("A\0HH");
579 // wxString _neq1 = wxT("H\0AH");
580 // wxString _neq2 = wxT("A\0H");
581 // wxString _neq3 = wxT("A\0HHH");
582 // wxString _neq4 = wxT("A\0hH");
585 neq1
.insert(1,1,'\0');
586 neq2
.insert(1,1,'\0');
587 neq3
.insert(1,1,'\0');
588 neq4
.insert(1,1,'\0');
590 CPPUNIT_ASSERT( s1
== eq
);
591 CPPUNIT_ASSERT( s1
!= neq1
);
592 CPPUNIT_ASSERT( s1
!= neq2
);
593 CPPUNIT_ASSERT( s1
!= neq3
);
594 CPPUNIT_ASSERT( s1
!= neq4
);
597 void StringTestCase::CompareNoCase()
599 wxString s1
= wxT("AHH");
600 wxString eq
= wxT("AHH");
601 wxString eq2
= wxT("AhH");
602 wxString eq3
= wxT("ahh");
603 wxString neq
= wxT("HAH");
604 wxString neq2
= wxT("AH");
605 wxString neq3
= wxT("AHHH");
607 #define CPPUNIT_CNCEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) == 0)
608 #define CPPUNIT_CNCNEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) != 0)
610 CPPUNIT_CNCEQ_ASSERT( s1
, eq
);
611 CPPUNIT_CNCEQ_ASSERT( s1
, eq2
);
612 CPPUNIT_CNCEQ_ASSERT( s1
, eq3
);
614 CPPUNIT_CNCNEQ_ASSERT( s1
, neq
);
615 CPPUNIT_CNCNEQ_ASSERT( s1
, neq2
);
616 CPPUNIT_CNCNEQ_ASSERT( s1
, neq3
);
619 // wxString _s1 = wxT("A\0HH");
620 // wxString _eq = wxT("A\0HH");
621 // wxString _eq2 = wxT("A\0hH");
622 // wxString _eq3 = wxT("a\0hh");
623 // wxString _neq = wxT("H\0AH");
624 // wxString _neq2 = wxT("A\0H");
625 // wxString _neq3 = wxT("A\0HHH");
629 eq2
.insert(1,1,'\0');
630 eq3
.insert(1,1,'\0');
631 neq
.insert(1,1,'\0');
632 neq2
.insert(1,1,'\0');
633 neq3
.insert(1,1,'\0');
635 CPPUNIT_CNCEQ_ASSERT( s1
, eq
);
636 CPPUNIT_CNCEQ_ASSERT( s1
, eq2
);
637 CPPUNIT_CNCEQ_ASSERT( s1
, eq3
);
639 CPPUNIT_CNCNEQ_ASSERT( s1
, neq
);
640 CPPUNIT_CNCNEQ_ASSERT( s1
, neq2
);
641 CPPUNIT_CNCNEQ_ASSERT( s1
, neq3
);
644 void StringTestCase::ToLong()
647 static const struct ToLongData
654 { _T("1"), 1, true },
655 { _T("0"), 0, true },
656 { _T("a"), 0, false },
657 { _T("12345"), 12345, true },
658 { _T("-1"), -1, true },
659 { _T("--1"), 0, false },
663 for ( n
= 0; n
< WXSIZEOF(longData
); n
++ )
665 const ToLongData
& ld
= longData
[n
];
666 CPPUNIT_ASSERT_EQUAL( ld
.ok
, wxString(ld
.str
).ToLong(&l
) );
668 CPPUNIT_ASSERT_EQUAL( ld
.value
, l
);
672 void StringTestCase::ToULong()
675 static const struct ToULongData
682 { _T("1"), 1, true },
683 { _T("0"), 0, true },
684 { _T("a"), 0, false },
685 { _T("12345"), 12345, true },
686 // this is surprizing but consistent with strtoul() behaviour
687 { _T("-1"), ULONG_MAX
, true },
691 for ( n
= 0; n
< WXSIZEOF(ulongData
); n
++ )
693 const ToULongData
& uld
= ulongData
[n
];
694 CPPUNIT_ASSERT_EQUAL( uld
.ok
, wxString(uld
.str
).ToULong(&ul
) );
696 CPPUNIT_ASSERT_EQUAL( uld
.value
, ul
);
700 void StringTestCase::ToDouble()
703 static const struct ToDoubleData
710 { _T("1"), 1, true },
711 { _T("1.23"), 1.23, true },
712 { _T(".1"), .1, true },
713 { _T("1."), 1, true },
714 { _T("1.."), 0, false },
715 { _T("0"), 0, true },
716 { _T("a"), 0, false },
717 { _T("12345"), 12345, true },
718 { _T("-1"), -1, true },
719 { _T("--1"), 0, false },
722 // we need to use decimal point, not comma or whatever is its value for the
724 wxSetlocale(LC_ALL
, _T("C"));
727 for ( n
= 0; n
< WXSIZEOF(doubleData
); n
++ )
729 const ToDoubleData
& ld
= doubleData
[n
];
730 CPPUNIT_ASSERT_EQUAL( ld
.ok
, wxString(ld
.str
).ToDouble(&d
) );
732 CPPUNIT_ASSERT_EQUAL( ld
.value
, d
);