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 );
232 // in case wcscmp is missing
234 static int wx_wcscmp(const wchar_t *s1
, const wchar_t *s2
)
236 while (*s1
== *s2
&& *s1
!= 0)
246 StringTestCase::DoTestConversion(const char *s
,
253 wxCharBuffer
buf(wxString(ws
).mb_str(conv
));
255 CPPUNIT_ASSERT( strcmp(buf
, s
) == 0 );
257 #else // wxUSE_UNICODE
260 wxWCharBuffer
wbuf(wxString(s
).wc_str(conv
));
263 CPPUNIT_ASSERT( wx_wcscmp(wbuf
, ws
) == 0 );
265 CPPUNIT_ASSERT( !*wbuf
);
267 #endif // wxUSE_UNICODE/!wxUSE_UNICODE
270 struct StringConversionData
276 void StringTestCase::ConversionUTF7()
278 static const StringConversionData utf7data
[] =
282 //\u isn't recognized on MSVC 6
283 #if !defined(_MSC_VER)
284 #if !defined(__GNUC__) || (__GNUC__ >= 3)
285 { "+AKM-", L
"\u00a3" },
288 // Windows accepts invalid UTF-7 strings and so does our UTF-7
289 // conversion code -- this is wrong IMO but the way it is for now
291 // notice that converting "+" still behaves as expected because the
292 // result is just an empty string, i.e. the same as if there were an
293 // error, but converting "a+" results in "a" while it really should
299 wxCSConv
conv(_T("utf-7"));
300 for ( size_t n
= 0; n
< WXSIZEOF(utf7data
); n
++ )
302 const StringConversionData
& d
= utf7data
[n
];
303 DoTestConversion(d
.str
, d
.wcs
, conv
);
307 void StringTestCase::ConversionUTF8()
309 static const StringConversionData utf8data
[] =
311 //\u isn't recognized on MSVC 6
312 #if !defined(_MSC_VER)
313 #if !defined(__GNUC__) || (__GNUC__ >= 3)
314 { "\xc2\xa3", L
"\u00a3" },
320 wxCSConv
conv(_T("utf-8"));
321 for ( size_t n
= 0; n
< WXSIZEOF(utf8data
); n
++ )
323 const StringConversionData
& d
= utf8data
[n
];
324 DoTestConversion(d
.str
, d
.wcs
, conv
);
328 #endif // wxUSE_WCHAR_T
331 void StringTestCase::Extraction()
333 wxString
s(_T("Hello, world!"));
335 CPPUNIT_ASSERT( wxStrcmp( s
.c_str() , _T("Hello, world!") ) == 0 );
336 CPPUNIT_ASSERT( wxStrcmp( s
.Left(5).c_str() , _T("Hello") ) == 0 );
337 CPPUNIT_ASSERT( wxStrcmp( s
.Right(6).c_str() , _T("world!") ) == 0 );
338 CPPUNIT_ASSERT( wxStrcmp( s(3, 5).c_str() , _T("lo, w") ) == 0 );
339 CPPUNIT_ASSERT( wxStrcmp( s
.Mid(3).c_str() , _T("lo, world!") ) == 0 );
340 CPPUNIT_ASSERT( wxStrcmp( s
.substr(3, 5).c_str() , _T("lo, w") ) == 0 );
341 CPPUNIT_ASSERT( wxStrcmp( s
.substr(3).c_str() , _T("lo, world!") ) == 0 );
345 #define TEST_STARTS_WITH( prefix , correct_rest, result ) \
347 ( s.StartsWith( prefix, &rest ) == result ) && \
348 ( ( result == false ) || ( wxStrcmp( correct_rest , rest ) == 0 ) ) \
351 TEST_STARTS_WITH( _T("Hello"), _T(", world!"), true );
352 TEST_STARTS_WITH( _T("Hello, "), _T("world!"), true );
353 TEST_STARTS_WITH( _T("Hello, world!"), _T(""), true );
354 TEST_STARTS_WITH( _T("Hello, world!!!"), _T(""), false );
355 TEST_STARTS_WITH( _T(""), _T("Hello, world!"), true );
356 TEST_STARTS_WITH( _T("Goodbye"), _T(""), false );
357 TEST_STARTS_WITH( _T("Hi"), _T(""), false );
359 #undef TEST_STARTS_WITH
362 void StringTestCase::Find()
364 #define TEST_FIND( str , start , result ) \
365 CPPUNIT_ASSERT( wxString(str).find(_T("ell"), start) == result );
367 TEST_FIND( _T("Well, hello world"), 0, 1 );
368 TEST_FIND( _T("Well, hello world"), 6, 7 );
369 TEST_FIND( _T("Well, hello world"), 9, wxString::npos
);
374 void StringTestCase::SingleTokenizerTest( wxChar
*str
, wxChar
*delims
, size_t count
, wxStringTokenizerMode mode
)
376 wxStringTokenizer
tkz( str
, delims
, mode
);
377 CPPUNIT_ASSERT( tkz
.CountTokens() == count
);
379 wxChar
*buf
, *s
= NULL
, *last
;
381 if ( tkz
.GetMode() == wxTOKEN_STRTOK
)
383 buf
= new wxChar
[wxStrlen(str
) + 1];
385 s
= wxStrtok(buf
, delims
, &last
);
393 while ( tkz
.HasMoreTokens() )
395 wxString token
= tkz
.GetNextToken();
398 CPPUNIT_ASSERT( token
== s
);
399 s
= wxStrtok(NULL
, delims
, &last
);
404 CPPUNIT_ASSERT( count2
== count
);
411 void StringTestCase::Tokenizer()
413 SingleTokenizerTest( _T(""), _T(" "), 0, wxTOKEN_DEFAULT
);
414 SingleTokenizerTest( _T("Hello, world"), _T(" "), 2, 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(",!"), 3, wxTOKEN_DEFAULT
);
419 SingleTokenizerTest( _T("Hello, world!"), _T(",!"), 3, wxTOKEN_RET_EMPTY_ALL
);
420 SingleTokenizerTest( _T("username:password:uid:gid:gecos:home:shell"), _T(":"), 7, wxTOKEN_DEFAULT
);
421 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 4, wxTOKEN_DEFAULT
);
422 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 6, wxTOKEN_RET_EMPTY
);
423 SingleTokenizerTest( _T("1 \t3\t4 6 "), wxDEFAULT_DELIMITERS
, 9, wxTOKEN_RET_EMPTY_ALL
);
424 SingleTokenizerTest( _T("01/02/99"), _T("/-"), 3, wxTOKEN_DEFAULT
);
425 SingleTokenizerTest( _T("01-02/99"), _T("/-"), 3, wxTOKEN_RET_DELIMS
);
428 // call this with the string to tokenize, delimeters to use and the expected
429 // positions (i.e. results of GetPosition()) after each GetNextToken() call,
430 // terminate positions with 0
431 static void DoTokenizerGetPosition(const wxChar
*s
,
432 const wxChar
*delims
, int pos
, ...)
434 wxStringTokenizer
tkz(s
, delims
);
436 CPPUNIT_ASSERT( tkz
.GetPosition() == 0 );
445 CPPUNIT_ASSERT( !tkz
.HasMoreTokens() );
451 CPPUNIT_ASSERT( tkz
.GetPosition() == (size_t)pos
);
453 pos
= va_arg(ap
, int);
459 void StringTestCase::TokenizerGetPosition()
461 DoTokenizerGetPosition(_T("foo"), _T("_"), 3, 0);
462 DoTokenizerGetPosition(_T("foo_bar"), _T("_"), 4, 7, 0);
463 DoTokenizerGetPosition(_T("foo_bar_"), _T("_"), 4, 8, 0);
466 void StringTestCase::Replace()
468 #define TEST_REPLACE( original , pos , len , replacement , result ) \
470 wxString s = original; \
471 s.replace( pos , len , replacement ); \
472 CPPUNIT_ASSERT( s == result ); \
475 TEST_REPLACE( _T("012-AWORD-XYZ"), 4, 5, _T("BWORD"), _T("012-BWORD-XYZ") );
476 TEST_REPLACE( _T("increase"), 0, 2, _T("de"), _T("decrease") );
477 TEST_REPLACE( _T("wxWindow"), 8, 0, _T("s"), _T("wxWindows") );
478 TEST_REPLACE( _T("foobar"), 3, 0, _T("-"), _T("foo-bar") );
479 TEST_REPLACE( _T("barfoo"), 0, 6, _T("foobar"), _T("foobar") );
482 #define TEST_NULLCHARREPLACE( o , olen, pos , len , replacement , r, rlen ) \
484 wxString s(o,olen); \
485 s.replace( pos , len , replacement ); \
486 CPPUNIT_ASSERT( s == wxString(r,rlen) ); \
489 TEST_NULLCHARREPLACE( _T("null\0char"), 9, 5, 1, _T("d"),
490 _T("null\0dhar"), 9 );
492 #define TEST_WXREPLACE( o , olen, olds, news, all, r, rlen ) \
494 wxString s(o,olen); \
495 s.Replace( olds, news, all ); \
496 CPPUNIT_ASSERT( s == wxString(r,rlen) ); \
499 TEST_WXREPLACE( _T("null\0char"), 9, _T("c"), _T("de"), true,
500 _T("null\0dehar"), 10 );
502 TEST_WXREPLACE( _T("null\0dehar"), 10, _T("de"), _T("c"), true,
503 _T("null\0char"), 9 );
505 #undef TEST_WXREPLACE
506 #undef TEST_NULLCHARREPLACE
510 void StringTestCase::Match()
512 #define TEST_MATCH( s1 , s2 , result ) \
513 CPPUNIT_ASSERT( wxString(s1).Matches(s2) == result )
515 TEST_MATCH( _T("foobar"), _T("foo*"), true );
516 TEST_MATCH( _T("foobar"), _T("*oo*"), true );
517 TEST_MATCH( _T("foobar"), _T("*bar"), true );
518 TEST_MATCH( _T("foobar"), _T("??????"), true );
519 TEST_MATCH( _T("foobar"), _T("f??b*"), true );
520 TEST_MATCH( _T("foobar"), _T("f?b*"), false );
521 TEST_MATCH( _T("foobar"), _T("*goo*"), false );
522 TEST_MATCH( _T("foobar"), _T("*foo"), false );
523 TEST_MATCH( _T("foobarfoo"), _T("*foo"), true );
524 TEST_MATCH( _T(""), _T("*"), true );
525 TEST_MATCH( _T(""), _T("?"), false );
531 void StringTestCase::CaseChanges()
533 wxString
s1(_T("Hello!"));
542 CPPUNIT_ASSERT( s1u
== _T("HELLO!") );
543 CPPUNIT_ASSERT( s1l
== _T("hello!") );
544 CPPUNIT_ASSERT( s2u
== wxEmptyString
);
545 CPPUNIT_ASSERT( s2l
== wxEmptyString
);
548 wxLocale
locRu(wxLANGUAGE_RUSSIAN
, 0 /* flags */);
551 // try upper casing 8bit strings
552 wxString
sUpper("\xdf"),
555 CPPUNIT_ASSERT( sUpper
.Lower() == sLower
);
556 CPPUNIT_ASSERT( sLower
.Upper() == sUpper
);
558 #endif // !wxUSE_UNICODE
561 void StringTestCase::Compare()
563 wxString s1
= wxT("AHH");
564 wxString eq
= wxT("AHH");
565 wxString neq1
= wxT("HAH");
566 wxString neq2
= wxT("AH");
567 wxString neq3
= wxT("AHHH");
568 wxString neq4
= wxT("AhH");
570 CPPUNIT_ASSERT( s1
== eq
);
571 CPPUNIT_ASSERT( s1
!= neq1
);
572 CPPUNIT_ASSERT( s1
!= neq2
);
573 CPPUNIT_ASSERT( s1
!= neq3
);
574 CPPUNIT_ASSERT( s1
!= neq4
);
576 // wxString _s1 = wxT("A\0HH");
577 // wxString _eq = wxT("A\0HH");
578 // wxString _neq1 = wxT("H\0AH");
579 // wxString _neq2 = wxT("A\0H");
580 // wxString _neq3 = wxT("A\0HHH");
581 // wxString _neq4 = wxT("A\0hH");
584 neq1
.insert(1,1,'\0');
585 neq2
.insert(1,1,'\0');
586 neq3
.insert(1,1,'\0');
587 neq4
.insert(1,1,'\0');
589 CPPUNIT_ASSERT( s1
== eq
);
590 CPPUNIT_ASSERT( s1
!= neq1
);
591 CPPUNIT_ASSERT( s1
!= neq2
);
592 CPPUNIT_ASSERT( s1
!= neq3
);
593 CPPUNIT_ASSERT( s1
!= neq4
);
596 void StringTestCase::CompareNoCase()
598 wxString s1
= wxT("AHH");
599 wxString eq
= wxT("AHH");
600 wxString eq2
= wxT("AhH");
601 wxString eq3
= wxT("ahh");
602 wxString neq
= wxT("HAH");
603 wxString neq2
= wxT("AH");
604 wxString neq3
= wxT("AHHH");
606 #define CPPUNIT_CNCEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) == 0)
607 #define CPPUNIT_CNCNEQ_ASSERT(s1, s2) CPPUNIT_ASSERT( s1.CmpNoCase(s2) != 0)
609 CPPUNIT_CNCEQ_ASSERT( s1
, eq
);
610 CPPUNIT_CNCEQ_ASSERT( s1
, eq2
);
611 CPPUNIT_CNCEQ_ASSERT( s1
, eq3
);
613 CPPUNIT_CNCNEQ_ASSERT( s1
, neq
);
614 CPPUNIT_CNCNEQ_ASSERT( s1
, neq2
);
615 CPPUNIT_CNCNEQ_ASSERT( s1
, neq3
);
618 // wxString _s1 = wxT("A\0HH");
619 // wxString _eq = wxT("A\0HH");
620 // wxString _eq2 = wxT("A\0hH");
621 // wxString _eq3 = wxT("a\0hh");
622 // wxString _neq = wxT("H\0AH");
623 // wxString _neq2 = wxT("A\0H");
624 // wxString _neq3 = wxT("A\0HHH");
628 eq2
.insert(1,1,'\0');
629 eq3
.insert(1,1,'\0');
630 neq
.insert(1,1,'\0');
631 neq2
.insert(1,1,'\0');
632 neq3
.insert(1,1,'\0');
634 CPPUNIT_CNCEQ_ASSERT( s1
, eq
);
635 CPPUNIT_CNCEQ_ASSERT( s1
, eq2
);
636 CPPUNIT_CNCEQ_ASSERT( s1
, eq3
);
638 CPPUNIT_CNCNEQ_ASSERT( s1
, neq
);
639 CPPUNIT_CNCNEQ_ASSERT( s1
, neq2
);
640 CPPUNIT_CNCNEQ_ASSERT( s1
, neq3
);
643 void StringTestCase::ToLong()
646 static const struct ToLongData
653 { _T("1"), 1, true },
654 { _T("0"), 0, true },
655 { _T("a"), 0, false },
656 { _T("12345"), 12345, true },
657 { _T("-1"), -1, true },
658 { _T("--1"), 0, false },
662 for ( n
= 0; n
< WXSIZEOF(longData
); n
++ )
664 const ToLongData
& ld
= longData
[n
];
665 CPPUNIT_ASSERT_EQUAL( ld
.ok
, wxString(ld
.str
).ToLong(&l
) );
667 CPPUNIT_ASSERT_EQUAL( ld
.value
, l
);
671 void StringTestCase::ToULong()
674 static const struct ToULongData
681 { _T("1"), 1, true },
682 { _T("0"), 0, true },
683 { _T("a"), 0, false },
684 { _T("12345"), 12345, true },
685 // this is surprizing but consistent with strtoul() behaviour
686 { _T("-1"), ULONG_MAX
, true },
690 for ( n
= 0; n
< WXSIZEOF(ulongData
); n
++ )
692 const ToULongData
& uld
= ulongData
[n
];
693 CPPUNIT_ASSERT_EQUAL( uld
.ok
, wxString(uld
.str
).ToULong(&ul
) );
695 CPPUNIT_ASSERT_EQUAL( uld
.value
, ul
);
699 void StringTestCase::ToDouble()
702 static const struct ToDoubleData
709 { _T("1"), 1, true },
710 { _T("1.23"), 1.23, true },
711 { _T(".1"), .1, true },
712 { _T("1."), 1, true },
713 { _T("1.."), 0, false },
714 { _T("0"), 0, true },
715 { _T("a"), 0, false },
716 { _T("12345"), 12345, true },
717 { _T("-1"), -1, true },
718 { _T("--1"), 0, false },
721 // we need to use decimal point, not comma or whatever is its value for the
723 wxSetlocale(LC_ALL
, _T("C"));
726 for ( n
= 0; n
< WXSIZEOF(doubleData
); n
++ )
728 const ToDoubleData
& ld
= doubleData
[n
];
729 CPPUNIT_ASSERT_EQUAL( ld
.ok
, wxString(ld
.str
).ToDouble(&d
) );
731 CPPUNIT_ASSERT_EQUAL( ld
.value
, d
);