mirror of
https://github.com/boostorg/format.git
synced 2026-01-28 07:12:11 +00:00
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
#include "boost/format.hpp"
|
|
|
|
#define BOOST_INCLUDE_MAIN
|
|
#include <boost/test/test_tools.hpp>
|
|
|
|
|
|
int test_main(int, char* [])
|
|
{
|
|
using std::wstring;
|
|
using boost::format;
|
|
using boost::wformat;
|
|
using boost::io::str;
|
|
|
|
if(str( format(" %% ") ) != " % ")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format("nothing") ) != "nothing")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format("%% ") ) != "% ")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format(" %%") ) != " %")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format(" %n ") ) != " ")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format("%n ") ) != " ")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
if(str( format(" %n") ) != " ")
|
|
BOOST_ERROR("Basic parsing without arguments Failed");
|
|
|
|
if(str( format("%%##%%##%%1 %1%00") % "Escaped OK" ) != "%##%##%1 Escaped OK00")
|
|
BOOST_ERROR("Basic parsing Failed");
|
|
if(str( format("%%##%#x ##%%1 %s00") % 20 % "Escaped OK" ) != "%##0x14 ##%1 Escaped OK00")
|
|
BOOST_ERROR("Basic p-parsing Failed") ;
|
|
if(str( wformat(L"%%##%%##%%1 %1%00") % L"Escaped OK" ) != L"%##%##%1 Escaped OK00")
|
|
BOOST_ERROR("Basic w-parsing Failed");
|
|
if(str( wformat(L"%%##%#x ##%%1 %s00") % 20 % L"Escaped OK" ) != L"%##0x14 ##%1 Escaped OK00")
|
|
BOOST_ERROR("Basic wp-parsing Failed") ;
|
|
return 0;
|
|
}
|