]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/uuid/test/test_tagging.cpp
1 // (C) Copyright Andy Tompkins 2009. Permission to copy, use, modify, sell and
2 // distribute this software is granted provided this copyright notice appears
3 // in all copies. This software is provided "as is" without express or implied
4 // warranty, and with no claim as to its suitability for any purpose.
6 // Distributed under the Boost Software License, Version 1.0. (See
7 // accompanying file LICENSE_1_0.txt or copy at
8 // https://www.boost.org/LICENSE_1_0.txt)
10 // libs/uuid/test/test_tagging.cpp -------------------------------//
12 #include <boost/uuid/uuid.hpp>
13 #include <boost/uuid/uuid_generators.hpp>
14 #include <boost/detail/lightweight_test.hpp>
20 : tag(boost::uuids::random_generator()())
24 explicit object(int state
)
25 : tag(boost::uuids::random_generator()())
29 object(object
const& rhs
)
34 bool operator==(object
const& rhs
) const {
35 return tag
== rhs
.tag
;
37 bool operator!=(object
const& rhs
) const {
38 return !(operator==(rhs
));
41 object
& operator=(object
const& rhs
) {
47 int get_state() const { return state
; }
48 void set_state(int new_state
) { state
= new_state
; }
51 boost::uuids::uuid tag
;
56 template <typename elem
, typename traits
>
57 std::basic_ostream
<elem
, traits
>& operator<<(std::basic_ostream
<elem
, traits
>& os
, object
const& o
)
63 int main(int, char*[])
68 BOOST_TEST_EQ(o1
, o2
);
71 BOOST_TEST_EQ(o1
, o2
);
76 BOOST_TEST_NE(o1
, o3
);
77 BOOST_TEST_NE(o2
, o3
);
79 return boost::report_errors();