]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/serialization/test/A.cpp
1 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
2 // A.cpp simple class test
4 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
5 // Use, modification and distribution is subject to the Boost Software
6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org for updates, documentation, and revision history.
12 #include <cstdlib> // rand()
13 #include <cstddef> // size_t
14 #include <boost/math/special_functions/next.hpp>
16 #include <boost/config.hpp>
17 #if defined(BOOST_NO_STDC_NAMESPACE)
24 #include <boost/detail/workaround.hpp>
25 #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
26 #include <boost/archive/dinkumware.hpp>
34 assert(0 == x
.size());
36 unsigned int i
= std::rand() % 27;
39 x
+= static_cast<typename
S::value_type
>('a' - 1 + i
);
44 void accumulate(std::size_t & s
, const T
& t
){
45 const char * tptr
= (const char *)(& t
);
46 unsigned int count
= sizeof(t
);
52 A::operator std::size_t () const {
53 std::size_t retval
= 0;
54 accumulate(retval
, b
);
55 #ifndef BOOST_NO_INT64_T
56 accumulate(retval
, f
);
57 accumulate(retval
, g
);
59 accumulate(retval
, l
);
60 accumulate(retval
, m
);
61 accumulate(retval
, n
);
62 accumulate(retval
, o
);
63 accumulate(retval
, p
);
64 accumulate(retval
, q
);
65 #ifndef BOOST_NO_CWCHAR
66 accumulate(retval
, r
);
68 accumulate(retval
, c
);
69 accumulate(retval
, s
);
70 accumulate(retval
, t
);
71 accumulate(retval
, u
);
72 accumulate(retval
, v
);
77 #pragma warning(push) // Save warning settings.
78 #pragma warning(disable : 4244) // Disable possible loss of data warning
84 #ifndef BOOST_NO_INT64_T
85 f(std::rand() * std::rand()),
86 g(std::rand() * std::rand()),
88 l(static_cast<enum h
>(std::rand() % 3)),
94 #ifndef BOOST_NO_CWCHAR
97 c(0xff & std::rand()),
98 s(0xff & std::rand()),
99 t(0xff & std::rand()),
102 w((float)std::rand()),
103 x((double)std::rand())
106 #ifndef BOOST_NO_STD_WSTRING
111 #if defined(_MSC_VER)
112 #pragma warning(pop) // Restore warnings to previous state.
116 A::operator==(const A
&rhs
) const {
121 #ifndef BOOST_NO_INT64_T
137 #ifndef BOOST_NO_CWCHAR
151 if(std::abs( boost::math::float_distance(w
, rhs
.w
)) > 1)
153 if(std::abs( boost::math::float_distance(x
, rhs
.x
)) > 1)
155 if(0 != y
.compare(rhs
.y
))
157 #ifndef BOOST_NO_STD_WSTRING
158 if(0 != z
.compare(rhs
.z
))
165 A::operator!=(const A
&rhs
) const {
166 return ! (*this == rhs
);
170 A::operator<(const A
&rhs
) const {
173 #ifndef BOOST_NO_INT64_T
191 #ifndef BOOST_NO_CWCHAR
209 int i
= y
.compare(rhs
.y
);
212 #ifndef BOOST_NO_STD_WSTRING
213 int j
= z
.compare(rhs
.z
);