From 7315ad282deb20baf442db235048f3efc4e93e1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 29 Jun 2007 17:30:56 +0000 Subject: [PATCH] test wxVsnprintf() printing to both wchar_t* and char* buffers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/strings/vsnprintf.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/strings/vsnprintf.cpp b/tests/strings/vsnprintf.cpp index c781f06f61..0d404d685e 100644 --- a/tests/strings/vsnprintf.cpp +++ b/tests/strings/vsnprintf.cpp @@ -84,8 +84,9 @@ int r; // // use with extreme care and only when you're really sure the warnings must be // suppressed! +template static int -wxUnsafeSnprintf(wxChar *buf, size_t len, const wxChar *fmt, ...) +wxUnsafeSnprintf(T *buf, size_t len, const wxChar *fmt, ...) { va_list args; va_start(args, fmt); @@ -153,7 +154,7 @@ private: void WrongFormatStrings(); #endif // wxUSE_WXVSNPRINTF void Miscellaneous(); - void Misc(wxChar *buffer, int size); + template void Misc(T *buffer, int size); // compares the expectedString and the result of wxVsnprintf() char by char // for all its lenght (not only for first expectedLen chars) and also @@ -380,7 +381,8 @@ void VsnprintfTestCase::LongLong() } #endif -void VsnprintfTestCase::Misc(wxChar *buffer, int size) +template +void VsnprintfTestCase::Misc(T *buffer, int size) { // Remember that wx*printf could be mapped either to system // implementation or to wx implementation. @@ -461,12 +463,18 @@ void VsnprintfTestCase::WrongFormatStrings() void VsnprintfTestCase::BigToSmallBuffer() { - wxChar buf[1024], buf2[16], buf3[4], buf4; - - Misc(buf, 1024); - Misc(buf2, 16); - Misc(buf3, 4); - Misc(&buf4, 1); + wchar_t bufw[1024], bufw2[16], bufw3[4], bufw4; + char bufa[1024], bufa2[16], bufa3[4], bufa4; + + Misc(bufw, 1024); + Misc(bufw2, 16); + Misc(bufw3, 4); + Misc(&bufw4, 1); + + Misc(bufa, 1024); + Misc(bufa2, 16); + Misc(bufa3, 4); + Misc(&bufa4, 1); } void VsnprintfTestCase::DoMisc( -- 2.45.2