test_uuid_class.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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.
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // https://www.boost.org/LICENSE_1_0.txt)
  8. // libs/uuid/test/test_uuid_class.cpp -------------------------------//
  9. #include <boost/uuid/uuid.hpp>
  10. #include <boost/uuid/uuid_generators.hpp>
  11. #include <boost/uuid/uuid_io.hpp>
  12. #include <boost/detail/lightweight_test.hpp>
  13. class uuid_class : public boost::uuids::uuid
  14. {
  15. public:
  16. uuid_class()
  17. : boost::uuids::uuid(boost::uuids::random_generator()())
  18. {}
  19. explicit uuid_class(boost::uuids::uuid const& u)
  20. : boost::uuids::uuid(u)
  21. {}
  22. };
  23. int main(int, char*[])
  24. {
  25. uuid_class u1;
  26. uuid_class u2;
  27. BOOST_TEST_NE(u1, u2);
  28. BOOST_TEST_EQ(u1.is_nil(), false);
  29. BOOST_TEST_EQ(u2.is_nil(), false);
  30. u2 = u1;
  31. BOOST_TEST_EQ(u1, u2);
  32. return boost::report_errors();
  33. }