]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/format/test/format_test_wstring.cpp
1 // ------------------------------------------------------------------------------
2 // format_test_wstring.cpp : test wchar_t format use (if supported)
3 // ------------------------------------------------------------------------------
5 // Copyright Samuel Krempp 2003. Use, modification, and distribution are
6 // subject to the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/format for library home page
11 // ------------------------------------------------------------------------------
13 #include "boost/format.hpp"
15 #define BOOST_INCLUDE_MAIN
16 #include <boost/test/test_tools.hpp>
19 int test_main(int, char* [])
25 #if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF)
27 wformat
wfmter(L
"%%##%%##%%1 %1%00");
28 if(str( wfmter
% L
"Escaped OK" ) != L
"%##%##%1 Escaped OK00")
29 BOOST_ERROR("Basic w-parsing Failed");
30 if(str( wformat(L
"%%##%#x ##%%1 %s00") % 20 % L
"Escaped OK" ) != L
"%##0x14 ##%1 Escaped OK00")
31 BOOST_ERROR("Basic wp-parsing Failed") ;
33 // testcase for https://svn.boost.org/trac10/ticket/7379 (for valgrind)
34 wformat
wfmt(L
"%1$.1f");
35 std::wstring ws
= str(wfmt
% 123.45f
);
36 BOOST_CHECK_EQUAL(ws
.compare(L
"123.4"), 0);
37 wformat
wfmt2(L
"%1$.0f %%");
38 std::wstring ws2
= (wfmt2
% 123.45f
).str();
39 BOOST_CHECK_EQUAL(ws2
.compare(L
"123 %"), 0);
41 #endif // wformat tests