make sure that wxProcess always have a valid PID set; add test unit for wxExecute...
[wxWidgets.git] / tests / strings / vsnprintf.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/strings/vsnprintf.cpp
3 // Purpose: wxVsnprintf unit test
4 // Author: Francesco Montorsi
5 // (part of this file was taken from CMP.c of TRIO package
6 // written by Bjorn Reese and Daniel Stenberg)
7 // Created: 2006-04-01
8 // RCS-ID: $Id$
9 // Copyright: (c) 2006 Francesco Montorsi, Bjorn Reese and Daniel Stenberg
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ----------------------------------------------------------------------------
13 // headers
14 // ----------------------------------------------------------------------------
15
16 #include "testprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #include "wx/crt.h"
23
24 #if wxUSE_WXVSNPRINTF
25
26 #ifndef WX_PRECOMP
27 #include "wx/wx.h"
28 #include "wx/wxchar.h"
29 #endif // WX_PRECOMP
30
31
32 // NOTE: for more info about the specification of wxVsnprintf() behaviour you can
33 // refer to the following page of the GNU libc manual:
34 // http://www.gnu.org/software/libc/manual/html_node/Formatted-Output.html
35
36
37
38 // ----------------------------------------------------------------------------
39 // global utilities for testing
40 // ----------------------------------------------------------------------------
41
42 #define MAX_TEST_LEN 1024
43
44 // temporary buffers
45 static wxChar buf[MAX_TEST_LEN];
46 int r;
47
48 // these macros makes it possible to write all tests without repeating a lot
49 // of times the wxT() macro
50 // NOTE: you should use expected strings with these macros which do not exceed
51 // MAX_TEST_LEN as these macro do check if the return value is == (int)wxStrlen(buf)
52
53 #define ASSERT_STR_EQUAL( a, b ) \
54 CPPUNIT_ASSERT_EQUAL( wxString(a), wxString(b) );
55
56 #define CMP6(expected, fmt, y, z, w, t) \
57 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z, w, t); \
58 CPPUNIT_ASSERT( r == (int)wxStrlen(buf) ); \
59 ASSERT_STR_EQUAL( wxT(expected), buf );
60
61 #define CMP5(expected, fmt, y, z, w) \
62 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z, w); \
63 CPPUNIT_ASSERT( r == (int)wxStrlen(buf) ); \
64 ASSERT_STR_EQUAL( wxT(expected), buf );
65
66 #define CMP4(expected, fmt, y, z) \
67 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z); \
68 CPPUNIT_ASSERT( r == (int)wxStrlen(buf) ); \
69 ASSERT_STR_EQUAL( wxT(expected), buf );
70
71 #define CMP3(expected, fmt, y) \
72 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y); \
73 CPPUNIT_ASSERT( r == (int)wxStrlen(buf) ); \
74 ASSERT_STR_EQUAL( wxT(expected), buf );
75
76 #define CMP2(expected, fmt) \
77 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt)); \
78 CPPUNIT_ASSERT( r == (int)wxStrlen(buf) ); \
79 ASSERT_STR_EQUAL( wxT(expected), buf );
80
81 // NOTE: this macro is used also with too-small buffers (see Miscellaneous())
82 // test function, thus the return value can be > size and thus we
83 // cannot check if r == (int)wxStrlen(buf)
84 #define CMPTOSIZE(buffer, size, failuremsg, expected, fmt, x, y, z, w) \
85 r=wxSnprintf(buffer, size, wxT(fmt), x, y, z, w); \
86 CPPUNIT_ASSERT( r > 0 ); \
87 CPPUNIT_ASSERT_EQUAL_MESSAGE( \
88 failuremsg, \
89 wxString(wxT(expected)).Left(size - 1), \
90 wxString(buffer))
91
92 // this is the same as wxSnprintf() but it passes the format string to
93 // wxVsnprintf() without using WX_ATTRIBUTE_PRINTF and thus suppresses the gcc
94 // checks (and resulting warnings) for the format string
95 //
96 // use with extreme care and only when you're really sure the warnings must be
97 // suppressed!
98 template<typename T>
99 static int
100 wxUnsafeSnprintf(T *buf, size_t len, const wxChar *fmt, ...)
101 {
102 va_list args;
103 va_start(args, fmt);
104
105 int rc = wxVsnprintf(buf, len, fmt, args);
106
107 va_end(args);
108
109 return rc;
110 }
111
112 // ----------------------------------------------------------------------------
113 // test class
114 // ----------------------------------------------------------------------------
115
116 class VsnprintfTestCase : public CppUnit::TestCase
117 {
118 public:
119 VsnprintfTestCase();
120
121 private:
122 CPPUNIT_TEST_SUITE( VsnprintfTestCase );
123 CPPUNIT_TEST( C );
124 CPPUNIT_TEST( D );
125 CPPUNIT_TEST( X );
126 CPPUNIT_TEST( O );
127 CPPUNIT_TEST( P );
128 CPPUNIT_TEST( N );
129 CPPUNIT_TEST( E );
130 CPPUNIT_TEST( F );
131 CPPUNIT_TEST( G );
132 CPPUNIT_TEST( S );
133 CPPUNIT_TEST( Asterisk );
134 CPPUNIT_TEST( Percent );
135 #ifdef wxLongLong_t
136 CPPUNIT_TEST( LongLong );
137 #endif
138
139 CPPUNIT_TEST( BigToSmallBuffer );
140 #if wxUSE_WXVSNPRINTF
141 CPPUNIT_TEST( WrongFormatStrings );
142 #endif // wxUSE_WXVSNPRINTF
143 CPPUNIT_TEST( Miscellaneous );
144 CPPUNIT_TEST_SUITE_END();
145
146 void C();
147 void D();
148 void X();
149 void O();
150 void P();
151 void N();
152 void E();
153 void F();
154 void G();
155 void S();
156 void Asterisk();
157 void Percent();
158 #ifdef wxLongLong_t
159 void LongLong();
160 #endif
161 void Unicode();
162
163 template<typename T>
164 void DoBigToSmallBuffer(T *buffer, int size);
165 void BigToSmallBuffer();
166
167 #if wxUSE_WXVSNPRINTF
168 void WrongFormatStrings();
169 #endif // wxUSE_WXVSNPRINTF
170
171 // compares the expectedString and the result of wxVsnprintf() char by char
172 // for all its lenght (not only for first expectedLen chars) and also
173 // checks the return value
174 void DoMisc(int expectedLen, const wxString& expectedString,
175 size_t max, const wxChar *format, ...);
176 void Miscellaneous();
177
178 virtual void setUp();
179
180 DECLARE_NO_COPY_CLASS(VsnprintfTestCase)
181 };
182
183 // register in the unnamed registry so that these tests are run by default
184 CPPUNIT_TEST_SUITE_REGISTRATION( VsnprintfTestCase );
185
186 // also include in it's own registry so that these tests can be run alone
187 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VsnprintfTestCase, "VsnprintfTestCase" );
188
189 VsnprintfTestCase::VsnprintfTestCase()
190 {
191 // this call is required to avoid check failures when running on machines
192 // with a locale where the decimal point is not '.'
193 wxSetlocale(LC_ALL, "C");
194 }
195
196 void VsnprintfTestCase::C()
197 {
198 CMP5("hi!", "%c%c%c", wxT('h'), wxT('i'), wxT('!'));
199
200 // NOTE:
201 // the NULL characters _can_ be passed to %c to e.g. create strings
202 // with embedded NULs (because strings are not always supposed to be
203 // NUL-terminated).
204
205 DoMisc(14, wxT("Hello \0 World!"), 16, wxT("Hello %c World!"), wxT('\0'));
206 }
207
208 void VsnprintfTestCase::D()
209 {
210 CMP3("+123456", "%+d", 123456);
211 CMP3("-123456", "%d", -123456);
212 CMP3(" 123456", "% d", 123456);
213 CMP3(" 123456", "%10d", 123456);
214 CMP3("0000123456", "%010d", 123456);
215 CMP3("-123456 ", "%-10d", -123456);
216 }
217
218 void VsnprintfTestCase::X()
219 {
220 CMP3("ABCD", "%X", 0xABCD);
221 CMP3("0XABCD", "%#X", 0xABCD);
222 CMP3("0xabcd", "%#x", 0xABCD);
223 }
224
225 void VsnprintfTestCase::O()
226 {
227 CMP3("1234567", "%o", 01234567);
228 CMP3("01234567", "%#o", 01234567);
229 }
230
231 void VsnprintfTestCase::P()
232 {
233 // WARNING: printing of pointers is not fully standard.
234 // GNU prints them as %#x except for NULL pointers which are
235 // printed as '(nil)'.
236 // MSVC always print them as %8X on 32 bit systems and as %16X
237 // on 64 bit systems
238 #ifdef __VISUALC__
239 #if SIZEOF_VOID_P == 4
240 CMP3("00ABCDEF", "%p", (void*)0xABCDEF);
241 CMP3("00000000", "%p", (void*)NULL);
242 #elif SIZEOF_VOID_P == 8
243 CMP3("0000ABCDEFABCDEF", "%p", (void*)0xABCDEFABCDEF);
244 CMP3("0000000000000000", "%p", (void*)NULL);
245 #endif
246 #elif defined(__GNUG__)
247 CMP3("0xabcdef", "%p", (void*)0xABCDEF);
248 CMP3("(nil)", "%p", (void*)NULL);
249 #endif
250 }
251
252 void VsnprintfTestCase::N()
253 {
254 int nchar;
255
256 wxSnprintf(buf, MAX_TEST_LEN, _T("%d %s%n\n"), 3, _T("bears"), &nchar);
257 CPPUNIT_ASSERT_EQUAL( 7, nchar );
258 }
259
260 void VsnprintfTestCase::E()
261 {
262 // NB: there are no standards about the minimum exponent width
263 // (and the width of the %e conversion specifier refers to the
264 // mantissa, not to the exponent).
265 // Since newer MSVC versions use 3 digits as minimum exponent
266 // width while GNU libc uses 2 digits as minimum width, here we
267 // workaround this problem using for the exponent values with at
268 // least three digits.
269 // Some examples:
270 // printf("%e",2.342E+02);
271 // -> under MSVC7.1 prints: 2.342000e+002
272 // -> under GNU libc 2.4 prints: 2.342000e+02
273 CMP3("2.342000e+112", "%e",2.342E+112);
274 CMP3("-2.3420e-112", "%10.4e",-2.342E-112);
275 CMP3("-2.3420e-112", "%11.4e",-2.342E-112);
276 CMP3(" -2.3420e-112", "%15.4e",-2.342E-112);
277
278 CMP3("-0.02342", "%G",-2.342E-02);
279 CMP3("3.1415E-116", "%G",3.1415e-116);
280 CMP3("0003.141500e+103", "%016e", 3141.5e100);
281 CMP3(" 3.141500e+103", "%16e", 3141.5e100);
282 CMP3("3.141500e+103 ", "%-16e", 3141.5e100);
283 CMP3("3.142e+103", "%010.3e", 3141.5e100);
284 }
285
286 void VsnprintfTestCase::F()
287 {
288 CMP3("3.300000", "%5f", 3.3);
289 CMP3("3.000000", "%5f", 3.0);
290 CMP3("0.000100", "%5f", .999999E-4);
291 CMP3("0.000990", "%5f", .99E-3);
292 CMP3("3333.000000", "%5f", 3333.0);
293 }
294
295 void VsnprintfTestCase::G()
296 {
297 // NOTE: the same about E() testcase applies here...
298
299 CMP3(" 3.3", "%5g", 3.3);
300 CMP3(" 3", "%5g", 3.0);
301 CMP3("9.99999e-115", "%5g", .999999E-114);
302 CMP3("0.00099", "%5g", .99E-3);
303 CMP3(" 3333", "%5g", 3333.0);
304 CMP3(" 0.01", "%5g", 0.01);
305
306 CMP3(" 3", "%5.g", 3.3);
307 CMP3(" 3", "%5.g", 3.0);
308 CMP3("1e-114", "%5.g", .999999E-114);
309 CMP3("0.0001", "%5.g", 1.0E-4);
310 CMP3("0.001", "%5.g", .99E-3);
311 CMP3("3e+103", "%5.g", 3333.0E100);
312 CMP3(" 0.01", "%5.g", 0.01);
313
314 CMP3(" 3.3", "%5.2g", 3.3);
315 CMP3(" 3", "%5.2g", 3.0);
316 CMP3("1e-114", "%5.2g", .999999E-114);
317 CMP3("0.00099", "%5.2g", .99E-3);
318 CMP3("3.3e+103", "%5.2g", 3333.0E100);
319 CMP3(" 0.01", "%5.2g", 0.01);
320 }
321
322 void VsnprintfTestCase::S()
323 {
324 CMP3(" abc", "%5s", wxT("abc"));
325 CMP3(" a", "%5s", wxT("a"));
326 CMP3("abcdefghi", "%5s", wxT("abcdefghi"));
327 CMP3("abc ", "%-5s", wxT("abc"));
328 CMP3("abcdefghi", "%-5s", wxT("abcdefghi"));
329
330 CMP3("abcde", "%.5s", wxT("abcdefghi"));
331
332 // do the same tests but with Unicode characters:
333 #if wxUSE_UNICODE
334
335 // Unicode code points from U+03B1 to U+03B9 are the greek letters alpha-iota;
336 // UTF8 encoding of such code points is 0xCEB1 to 0xCEB9
337
338 #define ALPHA "\xCE\xB1"
339 // alpha
340 #define ABC "\xCE\xB1\xCE\xB2\xCE\xB3"
341 // alpha+beta+gamma
342 #define ABCDE "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
343 // alpha+beta+gamma+delta+epsilon
344 #define ABCDEFGHI "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9"
345 // alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
346
347 #define ALPHA_w wxT(ALPHA)
348 #define ABC_w wxT(ABC)
349 #define ABCDE_w wxT(ABCDE)
350 #define ABCDEFGHI_w wxT(ABCDEFGHI)
351
352 // CMP3 uses wxT() on the first argument so we need to be careful
353 // when using string concatenation that all parts of the string after
354 // the first explicitely use wxT():
355 CMP3(" " ABC_w, "%5s", ABC);
356 CMP3(" " ALPHA_w, "%5s", ALPHA);
357 CMP3(ABCDEFGHI, "%5s", ABCDEFGHI);
358 CMP3(ABC L" ", "%-5s", ABC);
359 CMP3(ABCDEFGHI, "%-5s", ABCDEFGHI);
360 CMP3(ABCDE, "%.5s", ABCDEFGHI);
361 #endif
362
363 // test a string which has a NULL character after "ab";
364 // obviously it should be handled exactly like just as "ab"
365 CMP3(" ab", "%5s", wxT("ab\0cdefghi"));
366 }
367
368 void VsnprintfTestCase::Asterisk()
369 {
370 CMP5(" 0.1", "%*.*f", 10, 1, 0.123);
371 CMP5(" 0.1230", "%*.*f", 10, 4, 0.123);
372 CMP5("0.1", "%*.*f", 3, 1, 0.123);
373
374 CMP4("%0.002", "%%%.*f", 3, 0.0023456789);
375
376 CMP4(" a", "%*c", 8, 'a');
377 CMP4(" four", "%*s", 8, "four");
378 CMP6(" four four", "%*s %*s", 8, "four", 6, "four");
379 }
380
381 void VsnprintfTestCase::Percent()
382 {
383 // some tests without any argument passed through ...
384 CMP2("%", "%%");
385 CMP2("%%%", "%%%%%%");
386
387 CMP3("% abc", "%%%5s", wxT("abc"));
388 CMP3("% abc%", "%%%5s%%", wxT("abc"));
389
390 // do not test odd number of '%' symbols as different implementations
391 // of snprintf() give different outputs as this situation is not considered
392 // by any standard (in fact, GCC will also warn you about a spurious % if
393 // you write %%% as argument of some *printf function !)
394 // Compare(wxT("%"), wxT("%%%"));
395 }
396
397 #ifdef wxLongLong_t
398 void VsnprintfTestCase::LongLong()
399 {
400 CMP3("123456789", "%lld", (wxLongLong_t)123456789);
401 CMP3("-123456789", "%lld", (wxLongLong_t)-123456789);
402
403 CMP3("123456789", "%llu", (wxULongLong_t)123456789);
404
405 #ifdef __WXMSW__
406 CMP3("123456789", "%I64d", (wxLongLong_t)123456789);
407 CMP3("123456789abcdef", "%I64x", wxLL(0x123456789abcdef));
408 #endif
409 }
410 #endif
411
412 // this test is only for our own implementation, the system implementation
413 // doesn't always give errors for invalid format strings (e.g. glibc doesn't)
414 // and as it's not required too (the behaviour is "undefined" according to the
415 // spec), there is really no sense in testing for it
416 #if wxUSE_WXVSNPRINTF
417
418 void VsnprintfTestCase::WrongFormatStrings()
419 {
420 // test how wxVsnprintf() behaves with wrong format string:
421
422 #if 0
423 // NB: the next 2 tests currently return an error but it would be nice
424 // if they didn't (see ticket #9367)
425
426 // two positionals with the same index:
427 r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$s %1$s"), "hello");
428 CPPUNIT_ASSERT(r != -1);
429
430 // three positionals with the same index mixed with other pos args:
431 r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%4$d %2$f %1$s %2$s %3$d"), "hello", "world", 3, 4);
432 CPPUNIT_ASSERT(r != -1);
433 #endif
434
435 // a missing positional arg: this should result in an error but not all
436 // implementations detect it (e.g. glibc doesn't)
437 r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %3$d"), 1, 2, 3);
438 CPPUNIT_ASSERT_EQUAL(-1, r);
439
440 // positional and non-positionals in the same format string:
441 r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %d %3$d"), 1, 2, 3);
442 CPPUNIT_ASSERT_EQUAL(-1, r);
443 }
444
445 #endif // wxUSE_WXVSNPRINTF
446
447 // BigToSmallBuffer() test case helper:
448 template<typename T>
449 void VsnprintfTestCase::DoBigToSmallBuffer(T *buffer, int size)
450 {
451 // Remember that wx*printf could be mapped either to system
452 // implementation or to wx implementation.
453 // In the first case, when the output buffer is too small, the returned
454 // value can be the number of characters required for the output buffer
455 // (conforming to ISO C99; implemented in e.g. GNU libc >= 2.1), or
456 // just a negative number, usually -1; (this is how e.g. MSVC's
457 // *printf() behaves). Luckily, in all implementations, when the
458 // output buffer is too small, it's nonetheless filled up to its max size.
459 //
460 // Note that in the second case (i.e. when we're using our own implementation),
461 // wxVsnprintf() will return the number of characters written in the standard
462 // output or
463 // -1 if there was an error in the format string
464 // maxSize+1 if the output buffer is too small
465
466 wxString errStr;
467 errStr << "The size of the buffer was " << size;
468 std::string errMsg(errStr.mb_str());
469
470 // test without positionals
471 CMPTOSIZE(buffer, size, errMsg,
472 "123456789012 - test - 123 -4.567",
473 "%i%li - test - %d %.3f",
474 123, (long int)456789012, 123, -4.567);
475
476 #if wxUSE_PRINTF_POS_PARAMS
477 // test with positional
478 CMPTOSIZE(buffer, size, errMsg,
479 "-4.567 123 - test - 456789012 123",
480 "%4$.3f %1$i - test - %2$li %3$d",
481 123, (long int)456789012, 123, -4.567);
482 #endif
483
484 // test unicode/ansi conversion specifiers
485 //
486 // NB: we use wxUnsafeSnprintf() as %hs and %hc are invalid in printf
487 // format and gcc would warn about this otherwise
488
489 r = wxUnsafeSnprintf(buffer, size,
490 _T("unicode string/char: %ls/%lc -- ansi string/char: %hs/%hc"),
491 L"unicode", L'U', "ansi", 'A');
492 wxString expected =
493 wxString(wxT("unicode string/char: unicode/U -- ansi string/char: ansi/A")).Left(size - 1);
494
495 CPPUNIT_ASSERT( r != -1 );
496 CPPUNIT_ASSERT_EQUAL(
497 expected,
498 wxString(buffer)
499 );
500 }
501
502 void VsnprintfTestCase::BigToSmallBuffer()
503 {
504 // VC6 can't compile this code
505 #if !defined(__VISUALC__) || (__VISUALC__ >= 1310)
506 #if wxUSE_UNICODE
507 wchar_t bufw[1024], bufw2[16], bufw3[4], bufw4;
508 DoBigToSmallBuffer(bufw, 1024);
509 DoBigToSmallBuffer(bufw2, 16);
510 DoBigToSmallBuffer(bufw3, 4);
511 DoBigToSmallBuffer(&bufw4, 1);
512 #endif // wxUSE_UNICODE
513
514 char bufa[1024], bufa2[16], bufa3[4], bufa4;
515 DoBigToSmallBuffer(bufa, 1024);
516 DoBigToSmallBuffer(bufa2, 16);
517 DoBigToSmallBuffer(bufa3, 4);
518 DoBigToSmallBuffer(&bufa4, 1);
519 #endif // !VC6
520 }
521
522 // Miscellaneous() test case helper:
523 void VsnprintfTestCase::DoMisc(
524 int expectedLen,
525 const wxString& expectedString,
526 size_t max,
527 const wxChar *format, ...)
528 {
529 const size_t BUFSIZE = MAX_TEST_LEN - 1;
530 size_t i;
531 static int count = 0;
532
533 wxASSERT(max <= BUFSIZE);
534
535 for (i = 0; i < BUFSIZE; i++)
536 buf[i] = '*';
537 buf[BUFSIZE] = 0;
538
539 va_list ap;
540 va_start(ap, format);
541
542 int n = wxVsnprintf(buf, max, format, ap);
543
544 va_end(ap);
545
546 // Prepare messages so that it is possible to see from the error which
547 // test was running.
548 wxString errStr, overflowStr;
549 errStr << _T("No.: ") << ++count << _T(", expected: ") << expectedLen
550 << _T(" '") << expectedString << _T("', result: ");
551 overflowStr << errStr << _T("buffer overflow");
552 errStr << n << _T(" '") << buf << _T("'");
553
554 // turn them into std::strings
555 std::string errMsg(errStr.mb_str());
556 std::string overflowMsg(overflowStr.mb_str());
557
558 CPPUNIT_ASSERT_MESSAGE(errMsg,
559 (expectedLen == -1 && size_t(n) >= max) || expectedLen == n);
560
561 CPPUNIT_ASSERT_MESSAGE(errMsg, expectedString == buf);
562
563 for (i = max; i < BUFSIZE; i++)
564 CPPUNIT_ASSERT_MESSAGE(overflowMsg, buf[i] == '*');
565 }
566
567 void VsnprintfTestCase::Miscellaneous()
568 {
569 // expectedLen, expectedString, max, format, ...
570 DoMisc(5, wxT("-1234"), 8, wxT("%d"), -1234);
571 DoMisc(7, wxT("1234567"), 8, wxT("%d"), 1234567);
572 DoMisc(-1, wxT("1234567"), 8, wxT("%d"), 12345678);
573 DoMisc(-1, wxT("-123456"), 8, wxT("%d"), -1234567890);
574
575 DoMisc(6, wxT("123456"), 8, wxT("123456"));
576 DoMisc(7, wxT("1234567"), 8, wxT("1234567"));
577 DoMisc(-1, wxT("1234567"), 8, wxT("12345678"));
578
579 DoMisc(6, wxT("123450"), 8, wxT("12345%d"), 0);
580 DoMisc(7, wxT("1234560"), 8, wxT("123456%d"), 0);
581 DoMisc(-1, wxT("1234567"), 8, wxT("1234567%d"), 0);
582 DoMisc(-1, wxT("1234567"), 8, wxT("12345678%d"), 0);
583
584 DoMisc(6, wxT("12%45%"), 8, wxT("12%%45%%"));
585 DoMisc(7, wxT("12%45%7"), 8, wxT("12%%45%%7"));
586 DoMisc(-1, wxT("12%45%7"), 8, wxT("12%%45%%78"));
587
588 DoMisc(5, wxT("%%%%%"), 6, wxT("%%%%%%%%%%"));
589 DoMisc(6, wxT("%%%%12"), 7, wxT("%%%%%%%%%d"), 12);
590 }
591
592 #endif // wxUSE_WXVSNPRINTF