]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/system/test/snprintf_test.cpp
1 // Copyright 2021 Peter Dimov.
2 // Distributed under the Boost Software License, Version 1.0.
3 // http://www.boost.org/LICENSE_1_0.txt
5 #include <boost/system/detail/snprintf.hpp>
6 #include <boost/core/lightweight_test.hpp>
12 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
14 BOOST_TEST_CSTR_EQ( buffer
, "...xy...151..." );
19 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
21 BOOST_TEST_CSTR_EQ( buffer
, "...xy...151..." );
26 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
28 BOOST_TEST_CSTR_EQ( buffer
, "...xy...151..." );
33 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
35 BOOST_TEST_CSTR_EQ( buffer
, "...xy...151.." );
40 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
42 BOOST_TEST_CSTR_EQ( buffer
, "...x" );
47 boost::system::detail::snprintf( buffer
, sizeof(buffer
), "...%s...%d...", "xy", 151 );
49 BOOST_TEST_CSTR_EQ( buffer
, "" );
53 char buffer
[ 1 ] = { 'Q' };
54 boost::system::detail::snprintf( buffer
, 0, "...%s...%d...", "xy", 151 );
56 BOOST_TEST_EQ( buffer
[0], 'Q' );
59 return boost::report_errors();