]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/format/test/format_test1.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / format / test / format_test1.cpp
1 // ------------------------------------------------------------------------------
2 // libs/format/test/format_test1.cpp : test constructing objects and basic parsing
3 // ------------------------------------------------------------------------------
4
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)
8
9 // See http://www.boost.org/libs/format for library home page
10
11 // ------------------------------------------------------------------------------
12
13 #include "boost/format.hpp"
14
15 #define BOOST_INCLUDE_MAIN
16 #include <boost/test/test_tools.hpp>
17
18
19 int test_main(int, char* [])
20 {
21
22 using boost::format;
23 using boost::str;
24
25 if(str( format(" %% ") ) != " % ")
26 BOOST_ERROR("Basic parsing without arguments Failed");
27 if(str( format("nothing") ) != "nothing")
28 BOOST_ERROR("Basic parsing without arguments Failed");
29 if(str( format("%% ") ) != "% ")
30 BOOST_ERROR("Basic parsing without arguments Failed");
31 if(str( format(" %%") ) != " %")
32 BOOST_ERROR("Basic parsing without arguments Failed");
33 if(str( format(" %n ") ) != " ")
34 BOOST_ERROR("Basic parsing without arguments Failed");
35 if(str( format("%n ") ) != " ")
36 BOOST_ERROR("Basic parsing without arguments Failed");
37 if(str( format(" %n") ) != " ")
38 BOOST_ERROR("Basic parsing without arguments Failed");
39
40 if(str( format("%%##%%##%%1 %1%00") % "Escaped OK" ) != "%##%##%1 Escaped OK00")
41 BOOST_ERROR("Basic parsing Failed");
42 if(str( format("%%##%#x ##%%1 %s00") % 20 % "Escaped OK" ) != "%##0x14 ##%1 Escaped OK00")
43 BOOST_ERROR("Basic p-parsing Failed") ;
44
45 return 0;
46 }