mirror of
https://github.com/boostorg/endian.git
synced 2025-07-31 13:07:24 +02:00
Remove support files no longer used.
This commit is contained in:
@@ -1,132 +0,0 @@
|
||||
// boost run_timer.cpp -----------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1994-2006
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/system for documentation.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// define BOOST_ENDIAN_SOURCE so that <boost/endian/detail/config.hpp> knows
|
||||
// the library is being built (possibly exporting rather than importing code)
|
||||
#define BOOST_ENDIAN_SOURCE
|
||||
|
||||
#include <boost/endian/support/timer.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/cerrno.hpp>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
using boost::endian::microsecond_t;
|
||||
using boost::endian::times_t;
|
||||
using boost::system::error_code;
|
||||
|
||||
# if defined(BOOST_WINDOWS_API)
|
||||
# include <windows.h>
|
||||
# elif defined(BOOST_POSIX_API)
|
||||
# include <sys/times.h>
|
||||
# else
|
||||
# error unknown API
|
||||
# endif
|
||||
|
||||
namespace
|
||||
{
|
||||
const char * default_format =
|
||||
" %ws wall, %us user + %ss system = %ts cpu (%p%)\n";
|
||||
|
||||
void show_time(const char * format, int places, std::ostream& os,
|
||||
const times_t& times)
|
||||
// NOTE WELL: Will truncate least-significant digits to LDBL_DIG, which may
|
||||
// be as low as 10, although will be 15 for many common platforms.
|
||||
{
|
||||
if (times.wall < microsecond_t(0))
|
||||
return;
|
||||
if (places > 6)
|
||||
places = 6;
|
||||
else if (places < 0)
|
||||
places = 0;
|
||||
|
||||
boost::io::ios_flags_saver ifs(os);
|
||||
boost::io::ios_precision_saver ips(os);
|
||||
os.setf(std::ios_base::fixed, std::ios_base::floatfield);
|
||||
os.precision(places);
|
||||
|
||||
const long double sec = 1000000.0L;
|
||||
microsecond_t total = times.system + times.user;
|
||||
long double wall_sec = times.wall / sec;
|
||||
long double total_sec = total / sec;
|
||||
|
||||
for (; *format; ++format)
|
||||
{
|
||||
if (*format != '%' || !*(format+1) || !std::strchr("wustp", *(format+1)))
|
||||
os << *format;
|
||||
else
|
||||
{
|
||||
++format;
|
||||
switch (*format)
|
||||
{
|
||||
case 'w':
|
||||
os << times.wall / sec;
|
||||
break;
|
||||
case 'u':
|
||||
os << times.user / sec;
|
||||
break;
|
||||
case 's':
|
||||
os << times.system / sec;
|
||||
break;
|
||||
case 't':
|
||||
os << total / sec;
|
||||
break;
|
||||
case 'p':
|
||||
os.precision(1);
|
||||
if (wall_sec > 0.001L && total_sec > 0.001L)
|
||||
os << (total_sec/wall_sec) * 100.0;
|
||||
else
|
||||
os << "n/a";
|
||||
os.precision(places);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // unnamed namespace
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
// run_timer:: report --------------------------------------//
|
||||
|
||||
void run_timer::report()
|
||||
{
|
||||
show_time(!m_format
|
||||
? default_format
|
||||
: m_format,
|
||||
m_places, m_os, this->stop());
|
||||
}
|
||||
|
||||
error_code run_timer::report(error_code& ec)
|
||||
{
|
||||
try
|
||||
{
|
||||
report();
|
||||
ec = error_code();
|
||||
}
|
||||
|
||||
catch (...) // eat any exceptions
|
||||
{
|
||||
ec = error_code(EIO, system::generic_category());
|
||||
}
|
||||
|
||||
return ec;
|
||||
}
|
||||
|
||||
} // namespace endian
|
||||
} // namespace boost
|
@@ -1,38 +0,0 @@
|
||||
// boost run_timer_ctors.cpp -----------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2007
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/system for documentation.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// These constructors are in a separate file so that this translation unit will
|
||||
// not be linked in except when one of the constructors is actually used. This
|
||||
// is important since header <iostream> is required, and it incurs the cost of
|
||||
// the standard stream objects even if they are not used.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// define BOOST_ENDIAN_SOURCE so that <boost/endian/detail/config.hpp> knows
|
||||
// the library is being built (possibly exporting rather than importing code)
|
||||
#define BOOST_ENDIAN_SOURCE
|
||||
|
||||
#include <boost/endian/support/timer.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
run_timer::run_timer(int places)
|
||||
: m_places(places), m_os(std::cout), m_format(0) {}
|
||||
|
||||
run_timer::run_timer(const std::string& format, int places)
|
||||
: m_places(places), m_os(std::cout), m_format(new char[format.size()+1])
|
||||
{ std::strcpy(m_format, format.c_str()); }
|
||||
|
||||
} // namespace endian
|
||||
} // namespace boost
|
@@ -1,167 +0,0 @@
|
||||
// boost timer.cpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1994-2006
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/system for documentation.
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
// define BOOST_ENDIAN_SOURCE so that <boost/system/config.hpp> knows
|
||||
// the library is being built (possibly exporting rather than importing code)
|
||||
#define BOOST_ENDIAN_SOURCE
|
||||
|
||||
#include <boost/endian/support/timer.hpp>
|
||||
#include <boost/system/system_error.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/cerrno.hpp>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
|
||||
# if defined(BOOST_WINDOWS_API)
|
||||
# include <windows.h>
|
||||
# elif defined(BOOST_POSIX_API)
|
||||
# include <unistd.h>
|
||||
# include <sys/times.h>
|
||||
# else
|
||||
# error unknown API
|
||||
# endif
|
||||
|
||||
using boost::system::error_code;
|
||||
|
||||
# if defined(BOOST_POSIX_API)
|
||||
namespace
|
||||
{
|
||||
long tick_factor() // multiplier to convert ticks
|
||||
// to microseconds; -1 if unknown
|
||||
{
|
||||
static long tick_factor = 0;
|
||||
if (!tick_factor)
|
||||
{
|
||||
if ((tick_factor = ::sysconf(_SC_CLK_TCK)) <= 0)
|
||||
tick_factor = -1;
|
||||
else
|
||||
{
|
||||
assert(tick_factor <= 1000000L); // doesn't handle large ticks
|
||||
tick_factor = 1000000L / tick_factor; // compute factor
|
||||
if (!tick_factor) tick_factor = -1;
|
||||
}
|
||||
}
|
||||
return tick_factor;
|
||||
}
|
||||
} // unnamed namespace
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace endian
|
||||
{
|
||||
|
||||
BOOST_ENDIAN_DECL
|
||||
void times(times_t& current)
|
||||
{
|
||||
error_code ec;
|
||||
if (times(current, ec))
|
||||
boost::throw_exception(system::system_error(ec, "boost::endian::times"));
|
||||
}
|
||||
|
||||
BOOST_ENDIAN_DECL
|
||||
error_code& times(times_t& current, error_code& ec)
|
||||
{
|
||||
ec = error_code();
|
||||
# if defined(BOOST_WINDOWS_API)
|
||||
::GetSystemTimeAsFileTime((LPFILETIME)¤t.wall);
|
||||
FILETIME creation, exit;
|
||||
if (::GetProcessTimes(::GetCurrentProcess(), &creation, &exit,
|
||||
(LPFILETIME)¤t.system, (LPFILETIME)¤t.user))
|
||||
{
|
||||
current.wall /= 10; // Windows uses 100 nanosecond ticks
|
||||
current.user /= 10;
|
||||
current.system /= 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
ec = error_code(::GetLastError(), system::system_category());
|
||||
current.wall = current.system = current.user = microsecond_t(-1);
|
||||
}
|
||||
# else
|
||||
tms tm;
|
||||
clock_t c = ::times(&tm);
|
||||
if (c == -1) // error
|
||||
{
|
||||
ec = error_code(errno, system::system_category());
|
||||
current.wall = current.system = current.user = microsecond_t(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
current.wall = microsecond_t(c);
|
||||
current.system = microsecond_t(tm.tms_stime + tm.tms_cstime);
|
||||
current.user = microsecond_t(tm.tms_utime + tm.tms_cutime);
|
||||
if (tick_factor() != -1)
|
||||
{
|
||||
current.wall *= tick_factor();
|
||||
current.user *= tick_factor();
|
||||
current.system *= tick_factor();
|
||||
}
|
||||
else
|
||||
{
|
||||
ec = error_code(errno, system::system_category());
|
||||
current.wall = current.user = current.system = microsecond_t(-1);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
return ec;
|
||||
}
|
||||
|
||||
#define BOOST_TIMES(C) \
|
||||
if (m_flags& m_nothrow) \
|
||||
{ \
|
||||
error_code ec; \
|
||||
times(C, ec); \
|
||||
} \
|
||||
else \
|
||||
times(C);
|
||||
|
||||
// timer ---------------------------------------------------------------//
|
||||
|
||||
void timer::start()
|
||||
{
|
||||
m_flags = static_cast<m_flags_t>(m_flags& ~m_stopped);
|
||||
BOOST_TIMES(m_times);
|
||||
}
|
||||
|
||||
const times_t& timer::stop()
|
||||
{
|
||||
if (stopped()) return m_times;
|
||||
m_flags = static_cast<m_flags_t>(m_flags | m_stopped);
|
||||
|
||||
times_t current;
|
||||
BOOST_TIMES(current);
|
||||
m_times.wall = (current.wall - m_times.wall);
|
||||
m_times.user = (current.user - m_times.user);
|
||||
m_times.system = (current.system - m_times.system);
|
||||
return m_times;
|
||||
}
|
||||
|
||||
void timer::elapsed(times_t& current)
|
||||
{
|
||||
if (stopped())
|
||||
{
|
||||
current.wall = m_times.wall;
|
||||
current.user = m_times.user;
|
||||
current.system = m_times.system;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_TIMES(current);
|
||||
current.wall -= m_times.wall;
|
||||
current.user -= m_times.user;
|
||||
current.system -= m_times.system;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace endian
|
||||
} // namespace boost
|
@@ -1,127 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Language" content="en-us">
|
||||
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
||||
<meta name="ProgId" content="FrontPage.Editor.Document">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
||||
<title>Binary Stream I/O</title>
|
||||
<link rel="stylesheet" type="text/css" href="../../../doc/src/minimal.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table border="0" cellpadding="5" cellspacing="0"
|
||||
style="border-collapse: collapse">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="277"><a href="../../../index.htm"><img
|
||||
src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle"
|
||||
width="300" height="86" border="0" /></a></td>
|
||||
<td>
|
||||
<h1 align="center">Binary
|
||||
I/O Manipulators<br>
|
||||
for Binary Streams</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<table border="1" cellpadding="5" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111">
|
||||
<tr>
|
||||
<td>
|
||||
<p align="center"><b>Binary
|
||||
I/O Manipulators
|
||||
for Strings are not yet accepted into Boost as public components. Thus the
|
||||
header file is currently located in <boost/io/detail/bin_manip.hpp></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
<p>The C++ standard library's stream I/O facilities are type-safe and very
|
||||
convenient for performing formatted (i.e. human readable) I/O. But they offer only
|
||||
rudimentary and not very type-safe operations for performing unformatted binary I/O.
|
||||
Although formatted I/O is often preferable, some applications need the speed and
|
||||
storage efficiency of unformatted binary I/O or need to interoperate with third-party
|
||||
applications that require unformatted binary file or network data formats.</p>
|
||||
<p>Standard library streams can be opened with filemode <code>
|
||||
std::ios_base::binary</code>, so binary I/O is possible. But the only
|
||||
unformatted I/O functions available are <code>get()</code>, <code>put()</code>,
|
||||
<code>read()</code>, and <code>write()</code>. These operate only on <code>char</code>
|
||||
or array of <code>char</code> (with length explicitly specified), so require the
|
||||
user to write casts, are hard to use, and are error prone.</p>
|
||||
<p>There have been many requests on Boost and various C++ newsgroups for
|
||||
unformatted binary I/O. For example, in 2003 Neal Becker wrote:</p>
|
||||
<blockquote>
|
||||
<p>I wonder if anyone has code for implementing unformatted I/O? What I
|
||||
have in mind is for the simple case where the application that reads data knows
|
||||
the data types, so this is not as complicated as the general marshalling
|
||||
situation.</p>
|
||||
</blockquote>
|
||||
<p>This proposal provides a simple solution that works with standard library
|
||||
input and output streams. The one caveat is that the stream must be opened with filemode <code>std::ios_base::binary</code>
|
||||
to avoid certain data values being treated as line endings.</p>
|
||||
<h2>Synopsis</h2>
|
||||
<div dir="ltr">
|
||||
<pre>namespace boost
|
||||
{
|
||||
template <class T>
|
||||
<i>unspecified-type-1<T></i> bin(const T& x);
|
||||
|
||||
template <class T>
|
||||
<i>unspecified-type-2<T></i> bin(T& x);
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& os, <i>unspecified-type-1<T></i> x);
|
||||
|
||||
template <class T>
|
||||
std::ostream& operator<<(std::ostream& os, <i>unspecified-type-2<T></i> x);
|
||||
|
||||
template <class T>
|
||||
std::istream& operator>>(std::istream& is, <i>unspecified-type-2<T></i> x);
|
||||
}</pre>
|
||||
</div>
|
||||
<p><i><code>unspecified-type-1</code></i> and <i><code>unspecified-type-2</code></i>
|
||||
are implementation supplied types.</p>
|
||||
<h2>Example</h2>
|
||||
<blockquote>
|
||||
<pre>int main()
|
||||
{
|
||||
fstream f("binary_stream_example.dat",
|
||||
std::ios_base::trunc | std::ios_base::in | std::ios_base::out | std::ios_base::binary);
|
||||
|
||||
int32_t x = 0x01020304;
|
||||
int32_t y = 0;
|
||||
|
||||
f << bin(x);
|
||||
f.seekg(0);
|
||||
f >> bin(y);
|
||||
|
||||
BOOST_ASSERT(x == y);
|
||||
|
||||
return 0;
|
||||
}</pre>
|
||||
</blockquote>
|
||||
<p>The file produced will be four bytes in length. On a big-endian machine, the
|
||||
contents in hexadecimal are:</p>
|
||||
<blockquote>
|
||||
<pre>01020304</pre>
|
||||
</blockquote>
|
||||
<p>On a little-endian machine, the contents in hexadecimal are:</p>
|
||||
<blockquote>
|
||||
<pre>04030201</pre>
|
||||
</blockquote>
|
||||
<hr>
|
||||
<p>Last revised:
|
||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->26 May, 2011<!--webbot bot="Timestamp" endspan i-checksum="13972" --></p>
|
||||
<p><EFBFBD> Copyright Beman Dawes, 2009, 2011</p>
|
||||
<p>Distributed under the Boost Software License, Version 1.0. See
|
||||
<a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/ LICENSE_1_0.txt</a></p>
|
||||
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
<p> </p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -1,67 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost I/O Library</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="white" text="black">
|
||||
<table border="1" bgcolor="teal" cellpadding="2">
|
||||
<tr>
|
||||
<td bgcolor="white"><img src="../../../boost.png"
|
||||
alt="boost.png (6897 bytes)" width="277"
|
||||
height="86"></td>
|
||||
<td><a href="../../../index.htm"><font face="Arial"
|
||||
color="white"><big>Home</big></font></a></td>
|
||||
<td><a href="../../libraries.htm"><font face="Arial"
|
||||
color="white"><big>Libraries</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/people/people.htm"><font face="Arial"
|
||||
color="white"><big>People</big></font></a></td>
|
||||
<td><a href="http://www.boost.org/more/faq.htm"><font face="Arial"
|
||||
color="white"><big>FAQ</big></font></a></td>
|
||||
<td><a href="../../../more/index.htm"><font face="Arial"
|
||||
color="white"><big>More</big></font></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>Boost Input/Output Library</h1>
|
||||
|
||||
<table border="1" cellpadding="5" align="center">
|
||||
<tr>
|
||||
<th>Header / Docs</th>
|
||||
<th>Contents</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/io_fwd.hpp"><boost/io_fwd.hpp></a></code>
|
||||
</td>
|
||||
<td valign="top">
|
||||
Forward declaration header.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<code><a href="../../../boost/io/ios_state.hpp"><boost/io/ios_state.hpp></a></code><br>
|
||||
<br><a href="ios_state.html">documentation</a>
|
||||
</td>
|
||||
<td valign="top">
|
||||
State-saving classes for various IOStream attributes.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Rationale</h2>
|
||||
|
||||
<p>The I/O sub-library of Boost helps segregate the large number of
|
||||
Boost headers. This sub-library should contain various items to use
|
||||
with/for the standard I/O library.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>Revised: 26 Feb 2002</p>
|
||||
|
||||
<p>Copyright 2002 Daryle Walker. Use, modification, and distribution are
|
||||
subject to the Boost Software License, Version 1.0. (See accompanying file <a
|
||||
href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
|
||||
href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>>.)</p>
|
||||
</body>
|
||||
</html>
|
@@ -1,30 +0,0 @@
|
||||
// binary_stream_example.cpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2011
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/io/detail/bin_manip.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <fstream>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
fstream f("binary_stream_example.dat",
|
||||
std::ios_base::trunc | std::ios_base::in | std::ios_base::out | std::ios_base::binary);
|
||||
|
||||
int32_t x = 0x01020304;
|
||||
int32_t y = 0;
|
||||
|
||||
f << bin(x);
|
||||
f.seekg(0);
|
||||
f >> bin(y);
|
||||
BOOST_ASSERT(x == y);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
# Boost.IO Library test Jamfile
|
||||
#
|
||||
# Copyright 2003 Daryle Walker. Use, modification, and distribution
|
||||
# are subject to the Boost Software License, Version 1.0. (See
|
||||
# accompanying file LICENSE_1_0.txt or a copy at
|
||||
# <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||
#
|
||||
# See <http://www.boost.org/libs/io/> for the library's home page.
|
||||
|
||||
test-suite "io"
|
||||
: [ run ios_state_unit_test.cpp
|
||||
../../../libs/test/build//boost_unit_test_framework/<link>static
|
||||
: # args
|
||||
: # input files
|
||||
# : std::locale-support
|
||||
]
|
||||
|
||||
[ run ios_state_test.cpp
|
||||
../../../libs/test/build//boost_test_exec_monitor/<link>static
|
||||
: # args
|
||||
: # input files
|
||||
# : std::locale-support
|
||||
]
|
||||
|
||||
[ run quoted_manip_test.cpp ]
|
||||
[ run bin_manip_test.cpp ]
|
||||
;
|
@@ -1,112 +0,0 @@
|
||||
// bin_manip_test.cpp ----------------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2009
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/io/detail/bin_manip.hpp>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
std::stringstream ss( std::ios_base::in | std::ios_base::out | std::ios_base::binary );
|
||||
|
||||
short short_1(0x0102), short_2;
|
||||
ss.clear();
|
||||
ss << bin(short_1);
|
||||
ss >> bin(short_2);
|
||||
BOOST_TEST( short_1 == short_2 );
|
||||
|
||||
unsigned short ushort_1(0x0102), ushort_2;
|
||||
ss.clear();
|
||||
ss << bin(ushort_1);
|
||||
ss >> bin(ushort_2);
|
||||
BOOST_TEST( ushort_1 == ushort_2 );
|
||||
|
||||
int int_1(0x01020304), int_2;
|
||||
ss.clear();
|
||||
ss << bin(int_1);
|
||||
ss >> bin(int_2);
|
||||
BOOST_TEST( int_1 == int_2 );
|
||||
|
||||
unsigned int uint_1(0x01020304), uint_2;
|
||||
ss.clear();
|
||||
ss << bin(uint_1);
|
||||
ss >> bin(uint_2);
|
||||
BOOST_TEST( uint_1 == uint_2 );
|
||||
|
||||
long long_1(0x01020304L), long_2;
|
||||
ss.clear();
|
||||
ss << bin(long_1);
|
||||
ss >> bin(long_2);
|
||||
BOOST_TEST( long_1 == long_2 );
|
||||
|
||||
unsigned long ulong_1(0x01020304UL), ulong_2;
|
||||
ss.clear();
|
||||
ss << bin(ulong_1);
|
||||
ss >> bin(ulong_2);
|
||||
BOOST_TEST( ulong_1 == ulong_2 );
|
||||
|
||||
long long long_long_1(0x0102030405060708LL), long_long_2;
|
||||
ss.clear();
|
||||
ss << bin(long_long_1);
|
||||
ss >> bin(long_long_2);
|
||||
BOOST_TEST( long_long_1 == long_long_2 );
|
||||
|
||||
unsigned long long ulong_long_1(0x0102030405060708ULL), ulong_long_2;
|
||||
ss.clear();
|
||||
ss << bin(ulong_long_1);
|
||||
ss >> bin(ulong_long_2);
|
||||
BOOST_TEST( ulong_long_1 == ulong_long_2 );
|
||||
|
||||
float float_1(1.2F), float_2;
|
||||
ss.clear();
|
||||
ss << bin(float_1);
|
||||
ss >> bin(float_2);
|
||||
BOOST_TEST( float_1 == float_2 );
|
||||
|
||||
double double_1(1.2), double_2;
|
||||
ss.clear();
|
||||
ss << bin(double_1);
|
||||
ss >> bin(double_2);
|
||||
BOOST_TEST( double_1 == double_2 );
|
||||
|
||||
long double long_double_1(1.2), long_double_2;
|
||||
ss.clear();
|
||||
ss << bin(long_double_1);
|
||||
ss >> bin(long_double_2);
|
||||
BOOST_TEST( long_double_1 == long_double_2 );
|
||||
|
||||
char char_1(0x01), char_2;
|
||||
ss.clear();
|
||||
ss << bin(char_1);
|
||||
ss >> bin(char_2);
|
||||
BOOST_TEST( char_1 == char_2 );
|
||||
|
||||
signed char schar_1(0x01), schar_2;
|
||||
ss.clear();
|
||||
ss << bin(schar_1);
|
||||
ss >> bin(schar_2);
|
||||
BOOST_TEST( schar_1 == schar_2 );
|
||||
|
||||
unsigned char uchar_1(0x01), uchar_2;
|
||||
ss.clear();
|
||||
ss << bin(uchar_1);
|
||||
ss >> bin(uchar_2);
|
||||
BOOST_TEST( uchar_1 == uchar_2 );
|
||||
|
||||
wchar_t wchar_t_1(L'1'), wchar_t_2;
|
||||
ss.clear();
|
||||
ss << bin(wchar_t_1);
|
||||
ss >> bin(wchar_t_2);
|
||||
BOOST_TEST( wchar_t_1 == wchar_t_2 );
|
||||
|
||||
return ::boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user