]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/uuid/test/test_string_generator.cpp
6a418df37a22cf0402303e5e9e6f4176f3731aee
1 // (C) Copyright Andy Tompkins 2010. 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 // http://www.boost.org/LICENSE_1_0.txt)
10 // libs/uuid/test/test_string_generator.cpp -------------------------------//
12 #include <boost/uuid/uuid.hpp>
13 #include <boost/uuid/uuid_io.hpp>
14 #include <boost/uuid/string_generator.hpp>
15 #include <boost/detail/lightweight_test.hpp>
16 #include <boost/config.hpp>
19 int main(int, char*[])
21 using namespace boost::uuids
;
23 uuid nil_uuid
= {{0}};
24 BOOST_TEST_EQ(nil_uuid
.is_nil(), true);
27 uuid u
= gen("00000000-0000-0000-0000-000000000000");
28 BOOST_TEST_EQ(u
, nil_uuid
);
29 BOOST_TEST_EQ(u
.is_nil(), true);
31 const uuid u_increasing
= {{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }};
32 const uuid u_decreasing
= {{ 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }};
34 u
= gen("0123456789abcdef0123456789ABCDEF");
35 BOOST_TEST_EQ(u
, u_increasing
);
37 u
= gen("{0123456789abcdef0123456789ABCDEF}");
38 BOOST_TEST_EQ(u
, u_increasing
);
40 u
= gen("{01234567-89AB-CDEF-0123-456789abcdef}");
41 BOOST_TEST_EQ(u
, u_increasing
);
43 u
= gen("01234567-89AB-CDEF-0123-456789abcdef");
44 BOOST_TEST_EQ(u
, u_increasing
);
46 u
= gen(std::string("fedcba98-7654-3210-fedc-ba9876543210"));
47 BOOST_TEST_EQ(u
, u_decreasing
);
49 #ifndef BOOST_NO_STD_WSTRING
50 u
= gen(L
"fedcba98-7654-3210-fedc-ba9876543210");
51 BOOST_TEST_EQ(u
, u_decreasing
);
53 u
= gen(std::wstring(L
"01234567-89ab-cdef-0123-456789abcdef"));
54 BOOST_TEST_EQ(u
, u_increasing
);
55 #endif //BOOST_NO_STD_WSTRING
57 return boost::report_errors();