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/detail/lightweight_test.hpp> |
14 | #include <boost/format.hpp> |
15 | |
16 | int main(int, char* []) |
17 | { |
18 | using boost::format; |
19 | using boost::str; |
20 | |
21 | if(str( f: format(" %% " ) ) != " % " ) |
22 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
23 | if(str( f: format("nothing" ) ) != "nothing" ) |
24 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
25 | if(str( f: format("%% " ) ) != "% " ) |
26 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
27 | if(str( f: format(" %%" ) ) != " %" ) |
28 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
29 | if(str( f: format(" %n " ) ) != " " ) |
30 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
31 | if(str( f: format("%n " ) ) != " " ) |
32 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
33 | if(str( f: format(" %n" ) ) != " " ) |
34 | BOOST_ERROR("Basic parsing without arguments Failed" ); |
35 | |
36 | if(str( f: format("%%##%%##%%1 %1%00" ) % "Escaped OK" ) != "%##%##%1 Escaped OK00" ) |
37 | BOOST_ERROR("Basic parsing Failed" ); |
38 | if(str( f: format("%%##%#x ##%%1 %s00" ) % 20 % "Escaped OK" ) != "%##0x14 ##%1 Escaped OK00" ) |
39 | BOOST_ERROR("Basic p-parsing Failed" ) ; |
40 | |
41 | return boost::report_errors(); |
42 | } |
43 | |