]>
git.saurik.com Git - wxWidgets.git/blob - tests/strings/vsnprintf.cpp
9105a8190e55d5803c531732af1b5f6da30bd0bb
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)
9 // Copyright: (c) 2006 Francesco Montorsi, Bjorn Reese and Daniel Stenberg
10 ///////////////////////////////////////////////////////////////////////////////
12 // ----------------------------------------------------------------------------
14 // ----------------------------------------------------------------------------
28 #include "wx/wxchar.h"
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
37 // Visual C++ run-time produces different results from glibc (not sure if this
38 // was tested using other run-times to be honest) so adjust the test results in
39 // some cases. Remember that while we test our own wxPrintf() code here, it
40 // uses the system sprintf() for actual formatting so the results are still
41 // different under different systems.
43 // Notice that MinGW uses VC CRT by default but may use its own printf()
44 // implementation if __USE_MINGW_ANSI_STDIO is defined. And finally also notice
45 // that testing for __USE_MINGW_ANSI_STDIO directly results in a warning with
46 // -Wundef if it involves an operation with undefined __MINGW_FEATURES__ so
47 // test for the latter too to avoid it.
48 #if defined(__VISUALC__) || \
49 (defined(__MINGW32__) && !defined(__MINGW_FEATURES__) || !__USE_MINGW_ANSI_STDIO)
53 // ----------------------------------------------------------------------------
54 // global utilities for testing
55 // ----------------------------------------------------------------------------
57 #define MAX_TEST_LEN 1024
60 static wxChar buf
[MAX_TEST_LEN
];
63 // these macros makes it possible to write all tests without repeating a lot
64 // of times the wxT() macro
65 // NOTE: you should use expected strings with these macros which do not exceed
66 // MAX_TEST_LEN as these macro do check if the return value is == (int)wxStrlen(buf)
68 #define ASSERT_STR_EQUAL( a, b ) \
69 CPPUNIT_ASSERT_EQUAL( wxString(a), wxString(b) );
71 #define CMP6(expected, fmt, y, z, w, t) \
72 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z, w, t); \
73 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
74 ASSERT_STR_EQUAL( wxT(expected), buf );
76 #define CMP5(expected, fmt, y, z, w) \
77 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z, w); \
78 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
79 ASSERT_STR_EQUAL( wxT(expected), buf );
81 #define CMP4(expected, fmt, y, z) \
82 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y, z); \
83 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
84 ASSERT_STR_EQUAL( wxT(expected), buf );
86 #define CMP3(expected, fmt, y) \
87 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y); \
88 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
89 ASSERT_STR_EQUAL( wxT(expected), buf );
91 #define CMP3i(expected, fmt, y) \
92 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt), y); \
93 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
94 WX_ASSERT_MESSAGE( ("Expected \"%s\", got \"%s\"", expected, buf), \
95 wxStricmp(expected, buf) == 0 );
97 #define CMP2(expected, fmt) \
98 r=wxSnprintf(buf, MAX_TEST_LEN, wxT(fmt)); \
99 CPPUNIT_ASSERT_EQUAL( r, wxStrlen(buf) ); \
100 ASSERT_STR_EQUAL( wxT(expected), buf );
102 // NOTE: this macro is used also with too-small buffers (see Miscellaneous())
103 // test function, thus the return value can be > size and thus we
104 // cannot check if r == (int)wxStrlen(buf)
105 #define CMPTOSIZE(buffer, size, failuremsg, expected, fmt, x, y, z, w) \
106 r=wxSnprintf(buffer, size, wxT(fmt), x, y, z, w); \
107 CPPUNIT_ASSERT( r > 0 ); \
108 CPPUNIT_ASSERT_EQUAL_MESSAGE( \
110 wxString(wxT(expected)).Left(size - 1), \
113 // this is the same as wxSnprintf() but it passes the format string to
114 // wxVsnprintf() without using WX_ATTRIBUTE_PRINTF and thus suppresses the gcc
115 // checks (and resulting warnings) for the format string
117 // use with extreme care and only when you're really sure the warnings must be
121 wxUnsafeSnprintf(T
*buf
, size_t len
, const wxChar
*fmt
, ...)
126 int rc
= wxVsnprintf(buf
, len
, fmt
, args
);
133 // ----------------------------------------------------------------------------
135 // ----------------------------------------------------------------------------
137 class VsnprintfTestCase
: public CppUnit::TestCase
140 VsnprintfTestCase() {}
142 virtual void setUp();
145 CPPUNIT_TEST_SUITE( VsnprintfTestCase
);
156 CPPUNIT_TEST( Asterisk
);
157 CPPUNIT_TEST( Percent
);
159 CPPUNIT_TEST( LongLong
);
162 CPPUNIT_TEST( BigToSmallBuffer
);
163 CPPUNIT_TEST( WrongFormatStrings
);
164 CPPUNIT_TEST( Miscellaneous
);
165 CPPUNIT_TEST( GlibcMisc1
);
166 CPPUNIT_TEST( GlibcMisc2
);
167 CPPUNIT_TEST_SUITE_END();
187 void DoBigToSmallBuffer(T
*buffer
, int size
);
188 void BigToSmallBuffer();
190 void WrongFormatStrings();
192 // compares the expectedString and the result of wxVsnprintf() char by char
193 // for all its lenght (not only for first expectedLen chars) and also
194 // checks the return value
195 void DoMisc(int expectedLen
, const wxString
& expectedString
,
196 size_t max
, const wxChar
*format
, ...);
197 void Miscellaneous();
202 DECLARE_NO_COPY_CLASS(VsnprintfTestCase
)
205 // register in the unnamed registry so that these tests are run by default
206 CPPUNIT_TEST_SUITE_REGISTRATION( VsnprintfTestCase
);
208 // also include in it's own registry so that these tests can be run alone
209 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VsnprintfTestCase
, "VsnprintfTestCase" );
211 void VsnprintfTestCase::setUp()
213 // this call is required to avoid check failures when running on machines
214 // with a locale where the decimal point is not '.'
215 wxSetlocale(LC_ALL
, "C");
218 void VsnprintfTestCase::C()
220 CMP5("hi!", "%c%c%c", wxT('h'), wxT('i'), wxT('!'));
223 // the NULL characters _can_ be passed to %c to e.g. create strings
224 // with embedded NULs (because strings are not always supposed to be
227 DoMisc(14, wxT("Hello \0 World!"), 16, wxT("Hello %c World!"), wxT('\0'));
230 void VsnprintfTestCase::D()
232 CMP3("+123456", "%+d", 123456);
233 CMP3("-123456", "%d", -123456);
234 CMP3(" 123456", "% d", 123456);
235 CMP3(" 123456", "%10d", 123456);
236 CMP3("0000123456", "%010d", 123456);
237 CMP3("-123456 ", "%-10d", -123456);
240 void VsnprintfTestCase::X()
242 CMP3("ABCD", "%X", 0xABCD);
243 CMP3("0XABCD", "%#X", 0xABCD);
244 CMP3("0xabcd", "%#x", 0xABCD);
247 void VsnprintfTestCase::O()
249 CMP3("1234567", "%o", 01234567);
250 CMP3("01234567", "%#o", 01234567);
253 void VsnprintfTestCase::P()
255 // WARNING: printing of pointers is not fully standard.
256 // GNU prints them as %#x except for NULL pointers which are
257 // printed as '(nil)'.
258 // MSVC always print them as %8X on 32 bit systems and as %16X
260 // mingw32 uses MSVC CRT in old versions but is own implementation
261 // now which is somewhere in the middle as it uses %8x, so to
262 // catch both cases we use case-insensitive comparison here.
264 #if SIZEOF_VOID_P == 4
265 CMP3i("00ABCDEF", "%p", (void*)0xABCDEF);
266 CMP3("00000000", "%p", (void*)NULL
);
267 #elif SIZEOF_VOID_P == 8
268 CMP3i("0000ABCDEFABCDEF", "%p", (void*)0xABCDEFABCDEF);
269 CMP3("0000000000000000", "%p", (void*)NULL
);
271 #elif defined(__MINGW32__)
272 CMP3("0xabcdef", "%p", (void*)0xABCDEF);
273 CMP3("0", "%p", (void*)NULL
);
274 #elif defined(__GNUG__)
275 CMP3("0xabcdef", "%p", (void*)0xABCDEF);
276 CMP3("(nil)", "%p", (void*)NULL
);
280 void VsnprintfTestCase::N()
284 wxSnprintf(buf
, MAX_TEST_LEN
, wxT("%d %s%n\n"), 3, wxT("bears"), &nchar
);
285 CPPUNIT_ASSERT_EQUAL( 7, nchar
);
288 void VsnprintfTestCase::E()
290 // NB: there are no standards about the minimum exponent width
291 // (and the width of the %e conversion specifier refers to the
292 // mantissa, not to the exponent).
293 // Since newer MSVC versions use 3 digits as minimum exponent
294 // width while GNU libc uses 2 digits as minimum width, here we
295 // workaround this problem using for the exponent values with at
296 // least three digits.
298 // printf("%e",2.342E+02);
299 // -> under MSVC7.1 prints: 2.342000e+002
300 // -> under GNU libc 2.4 prints: 2.342000e+02
301 CMP3("2.342000e+112", "%e",2.342E+112);
302 CMP3("-2.3420e-112", "%10.4e",-2.342E-112);
303 CMP3("-2.3420e-112", "%11.4e",-2.342E-112);
304 CMP3(" -2.3420e-112", "%15.4e",-2.342E-112);
306 CMP3("-0.02342", "%G",-2.342E-02);
307 CMP3("3.1415E-116", "%G",3.1415e-116);
308 CMP3("0003.141500e+103", "%016e", 3141.5e100
);
309 CMP3(" 3.141500e+103", "%16e", 3141.5e100
);
310 CMP3("3.141500e+103 ", "%-16e", 3141.5e100
);
311 CMP3("3.142e+103", "%010.3e", 3141.5e100
);
314 void VsnprintfTestCase::F()
316 CMP3("3.300000", "%5f", 3.3);
317 CMP3("3.000000", "%5f", 3.0);
318 CMP3("0.000100", "%5f", .999999E-4);
319 CMP3("0.000990", "%5f", .99E-3);
320 CMP3("3333.000000", "%5f", 3333.0);
323 void VsnprintfTestCase::G()
325 // NOTE: the same about E() testcase applies here...
327 CMP3(" 3.3", "%5g", 3.3);
328 CMP3(" 3", "%5g", 3.0);
329 CMP3("9.99999e-115", "%5g", .999999E-114);
330 CMP3("0.00099", "%5g", .99E-3);
331 CMP3(" 3333", "%5g", 3333.0);
332 CMP3(" 0.01", "%5g", 0.01);
334 CMP3(" 3", "%5.g", 3.3);
335 CMP3(" 3", "%5.g", 3.0);
336 CMP3("1e-114", "%5.g", .999999E-114);
337 CMP3("0.0001", "%5.g", 1.0E-4);
338 CMP3("0.001", "%5.g", .99E-3);
339 CMP3("3e+103", "%5.g", 3333.0E100
);
340 CMP3(" 0.01", "%5.g", 0.01);
342 CMP3(" 3.3", "%5.2g", 3.3);
343 CMP3(" 3", "%5.2g", 3.0);
344 CMP3("1e-114", "%5.2g", .999999E-114);
345 CMP3("0.00099", "%5.2g", .99E-3);
346 CMP3("3.3e+103", "%5.2g", 3333.0E100
);
347 CMP3(" 0.01", "%5.2g", 0.01);
350 void VsnprintfTestCase::S()
352 CMP3(" abc", "%5s", wxT("abc"));
353 CMP3(" a", "%5s", wxT("a"));
354 CMP3("abcdefghi", "%5s", wxT("abcdefghi"));
355 CMP3("abc ", "%-5s", wxT("abc"));
356 CMP3("abcdefghi", "%-5s", wxT("abcdefghi"));
358 CMP3("abcde", "%.5s", wxT("abcdefghi"));
360 // do the same tests but with Unicode characters:
363 // Unicode code points from U+03B1 to U+03B9 are the greek letters alpha-iota;
364 // UTF8 encoding of such code points is 0xCEB1 to 0xCEB9
366 #define ALPHA "\xCE\xB1"
368 #define ABC "\xCE\xB1\xCE\xB2\xCE\xB3"
370 #define ABCDE "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5"
371 // alpha+beta+gamma+delta+epsilon
372 #define ABCDEFGHI "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9"
373 // alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
375 // the 'expected' and 'arg' parameters of this macro are supposed to be
377 #define CMP3_UTF8(expected, fmt, arg) \
378 CPPUNIT_ASSERT_EQUAL \
380 wxString::FromUTF8(expected).length(), \
381 wxSnprintf(buf, MAX_TEST_LEN, fmt, wxString::FromUTF8(arg)) \
383 CPPUNIT_ASSERT_EQUAL \
385 wxString::FromUTF8(expected), \
389 CMP3_UTF8(" " ABC
, "%5s", ABC
);
390 CMP3_UTF8(" " ALPHA
, "%5s", ALPHA
);
391 CMP3_UTF8(ABCDEFGHI
, "%5s", ABCDEFGHI
);
392 CMP3_UTF8(ABC
" ", "%-5s", ABC
);
393 CMP3_UTF8(ABCDEFGHI
, "%-5s", ABCDEFGHI
);
394 CMP3_UTF8(ABCDE
, "%.5s", ABCDEFGHI
);
395 #endif // wxUSE_UNICODE
397 // test a string which has a NULL character after "ab";
398 // obviously it should be handled exactly like just as "ab"
399 CMP3(" ab", "%5s", wxT("ab\0cdefghi"));
402 void VsnprintfTestCase::Asterisk()
404 CMP5(" 0.1", "%*.*f", 10, 1, 0.123);
405 CMP5(" 0.1230", "%*.*f", 10, 4, 0.123);
406 CMP5("0.1", "%*.*f", 3, 1, 0.123);
408 CMP4("%0.002", "%%%.*f", 3, 0.0023456789);
410 CMP4(" a", "%*c", 8, 'a');
411 CMP4(" four", "%*s", 8, "four");
412 CMP6(" four four", "%*s %*s", 8, "four", 6, "four");
415 void VsnprintfTestCase::Percent()
417 // some tests without any argument passed through ...
419 CMP2("%%%", "%%%%%%");
421 CMP3("% abc", "%%%5s", wxT("abc"));
422 CMP3("% abc%", "%%%5s%%", wxT("abc"));
424 // do not test odd number of '%' symbols as different implementations
425 // of snprintf() give different outputs as this situation is not considered
426 // by any standard (in fact, GCC will also warn you about a spurious % if
427 // you write %%% as argument of some *printf function !)
428 // Compare(wxT("%"), wxT("%%%"));
432 void VsnprintfTestCase::LongLong()
434 CMP3("123456789", "%lld", (wxLongLong_t
)123456789);
435 CMP3("-123456789", "%lld", (wxLongLong_t
)-123456789);
437 CMP3("123456789", "%llu", (wxULongLong_t
)123456789);
440 CMP3("123456789", "%I64d", (wxLongLong_t
)123456789);
441 CMP3("123456789abcdef", "%I64x", wxLL(0x123456789abcdef));
446 void VsnprintfTestCase::WrongFormatStrings()
448 // test how wxVsnprintf() behaves with wrong format string:
451 // NB: the next 2 tests currently return an error but it would be nice
452 // if they didn't (see ticket #9367)
454 // two positionals with the same index:
455 r
= wxSnprintf(buf
, MAX_TEST_LEN
, wxT("%1$s %1$s"), "hello");
456 CPPUNIT_ASSERT(r
!= -1);
458 // three positionals with the same index mixed with other pos args:
459 r
= wxSnprintf(buf
, MAX_TEST_LEN
, wxT("%4$d %2$f %1$s %2$s %3$d"), "hello", "world", 3, 4);
460 CPPUNIT_ASSERT(r
!= -1);
463 // a missing positional arg should result in an assert
464 WX_ASSERT_FAILS_WITH_ASSERT(
465 wxSnprintf(buf
, MAX_TEST_LEN
, wxT("%1$d %3$d"), 1, 2, 3) );
467 // positional and non-positionals in the same format string:
468 r
= wxSnprintf(buf
, MAX_TEST_LEN
, wxT("%1$d %d %3$d"), 1, 2, 3);
469 CPPUNIT_ASSERT_EQUAL(-1, r
);
472 // BigToSmallBuffer() test case helper:
474 void VsnprintfTestCase::DoBigToSmallBuffer(T
*buffer
, int size
)
476 // Remember that wx*printf could be mapped either to system
477 // implementation or to wx implementation.
478 // In the first case, when the output buffer is too small, the returned
479 // value can be the number of characters required for the output buffer
480 // (conforming to ISO C99; implemented in e.g. GNU libc >= 2.1), or
481 // just a negative number, usually -1; (this is how e.g. MSVC's
482 // *printf() behaves). Luckily, in all implementations, when the
483 // output buffer is too small, it's nonetheless filled up to its max size.
485 // Note that in the second case (i.e. when we're using our own implementation),
486 // wxVsnprintf() will return the number of characters written in the standard
488 // -1 if there was an error in the format string
489 // maxSize+1 if the output buffer is too small
492 errStr
<< "The size of the buffer was " << size
;
493 std::string
errMsg(errStr
.mb_str());
495 // test without positionals
496 CMPTOSIZE(buffer
, size
, errMsg
,
497 "123456789012 - test - 123 -4.567",
498 "%i%li - test - %d %.3f",
499 123, (long int)456789012, 123, -4.567);
501 #if wxUSE_PRINTF_POS_PARAMS
502 // test with positional
503 CMPTOSIZE(buffer
, size
, errMsg
,
504 "-4.567 123 - test - 456789012 123",
505 "%4$.3f %1$i - test - %2$li %3$d",
506 123, (long int)456789012, 123, -4.567);
509 // test unicode/ansi conversion specifiers
511 // NB: we use wxUnsafeSnprintf() as %hs and %hc are invalid in printf
512 // format and gcc would warn about this otherwise
514 r
= wxUnsafeSnprintf(buffer
, size
,
515 wxT("unicode string/char: %ls/%lc -- ansi string/char: %hs/%hc"),
516 L
"unicode", L
'U', "ansi", 'A');
518 wxString(wxT("unicode string/char: unicode/U -- ansi string/char: ansi/A")).Left(size
- 1);
520 CPPUNIT_ASSERT( r
!= -1 );
521 CPPUNIT_ASSERT_EQUAL(
527 void VsnprintfTestCase::BigToSmallBuffer()
529 // VC6 can't compile this code
530 #if !defined(__VISUALC__) || (__VISUALC__ >= 1310)
532 wchar_t bufw
[1024], bufw2
[16], bufw3
[4], bufw4
;
533 DoBigToSmallBuffer(bufw
, 1024);
534 DoBigToSmallBuffer(bufw2
, 16);
535 DoBigToSmallBuffer(bufw3
, 4);
536 DoBigToSmallBuffer(&bufw4
, 1);
537 #endif // wxUSE_UNICODE
539 char bufa
[1024], bufa2
[16], bufa3
[4], bufa4
;
540 DoBigToSmallBuffer(bufa
, 1024);
541 DoBigToSmallBuffer(bufa2
, 16);
542 DoBigToSmallBuffer(bufa3
, 4);
543 DoBigToSmallBuffer(&bufa4
, 1);
547 // Miscellaneous() test case helper:
548 void VsnprintfTestCase::DoMisc(
550 const wxString
& expectedString
,
552 const wxChar
*format
, ...)
554 const size_t BUFSIZE
= MAX_TEST_LEN
- 1;
556 static int count
= 0;
558 wxASSERT(max
<= BUFSIZE
);
560 for (i
= 0; i
< BUFSIZE
; i
++)
565 va_start(ap
, format
);
567 int n
= wxVsnprintf(buf
, max
, format
, ap
);
571 // Prepare messages so that it is possible to see from the error which
573 wxString errStr
, overflowStr
;
574 errStr
<< wxT("No.: ") << ++count
<< wxT(", expected: ") << expectedLen
575 << wxT(" '") << expectedString
<< wxT("', result: ");
576 overflowStr
<< errStr
<< wxT("buffer overflow");
577 errStr
<< n
<< wxT(" '") << buf
<< wxT("'");
579 // turn them into std::strings
580 std::string
errMsg(errStr
.mb_str());
581 std::string
overflowMsg(overflowStr
.mb_str());
583 CPPUNIT_ASSERT_MESSAGE(errMsg
,
584 (expectedLen
== -1 && size_t(n
) >= max
) || expectedLen
== n
);
586 CPPUNIT_ASSERT_MESSAGE(errMsg
, expectedString
== buf
);
588 for (i
= max
; i
< BUFSIZE
; i
++)
589 CPPUNIT_ASSERT_MESSAGE(overflowMsg
, buf
[i
] == '*');
592 void VsnprintfTestCase::Miscellaneous()
594 // expectedLen, expectedString, max, format, ...
595 DoMisc(5, wxT("-1234"), 8, wxT("%d"), -1234);
596 DoMisc(7, wxT("1234567"), 8, wxT("%d"), 1234567);
597 DoMisc(-1, wxT("1234567"), 8, wxT("%d"), 12345678);
598 DoMisc(-1, wxT("-123456"), 8, wxT("%d"), -1234567890);
600 DoMisc(6, wxT("123456"), 8, wxT("123456"));
601 DoMisc(7, wxT("1234567"), 8, wxT("1234567"));
602 DoMisc(-1, wxT("1234567"), 8, wxT("12345678"));
604 DoMisc(6, wxT("123450"), 8, wxT("12345%d"), 0);
605 DoMisc(7, wxT("1234560"), 8, wxT("123456%d"), 0);
606 DoMisc(-1, wxT("1234567"), 8, wxT("1234567%d"), 0);
607 DoMisc(-1, wxT("1234567"), 8, wxT("12345678%d"), 0);
609 DoMisc(6, wxT("12%45%"), 8, wxT("12%%45%%"));
610 DoMisc(7, wxT("12%45%7"), 8, wxT("12%%45%%7"));
611 DoMisc(-1, wxT("12%45%7"), 8, wxT("12%%45%%78"));
613 DoMisc(5, wxT("%%%%%"), 6, wxT("%%%%%%%%%%"));
614 DoMisc(6, wxT("%%%%12"), 7, wxT("%%%%%%%%%d"), 12);
618 /* (C) Copyright C E Chew
620 * Feel free to copy, use and distribute this software provided:
622 * 1. you do not pretend that you wrote it
623 * 2. you leave this copyright notice intact.
626 void VsnprintfTestCase::GlibcMisc1()
628 CMP3(" ", "%5.s", "xyz");
629 CMP3(" 33", "%5.f", 33.3);
631 // see the previous notes about the minimum width of mantissa:
632 CMP3(" 3e+008", "%8.e", 33.3e7
);
633 CMP3(" 3E+008", "%8.E", 33.3e7
);
634 CMP3("3e+001", "%.g", 33.3);
635 CMP3("3E+001", "%.G", 33.3);
637 CMP3(" 3e+08", "%8.e", 33.3e7
);
638 CMP3(" 3E+08", "%8.E", 33.3e7
);
639 CMP3("3e+01", "%.g", 33.3);
640 CMP3("3E+01", "%.G", 33.3);
644 void VsnprintfTestCase::GlibcMisc2()
647 wxString test_format
;
650 CMP4("3", "%.*g", prec
, 3.3);
653 CMP4("3", "%.*G", prec
, 3.3);
656 CMP4(" 3", "%7.*G", prec
, 3.33);
659 CMP4(" 041", "%04.*o", prec
, 33);
662 CMP4(" 0000033", "%09.*u", prec
, 33);
665 CMP4(" 021", "%04.*x", prec
, 33);
668 CMP4(" 021", "%04.*X", prec
, 33);
671 #endif // wxUSE_WXVSNPRINTF