test_uuid_in_map.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // (C) Copyright Andy Tompkins 2011. 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_in_map.cpp -------------------------------//
  9. #include <boost/uuid/uuid.hpp>
  10. #include <boost/uuid/uuid_generators.hpp>
  11. #include <map>
  12. #include <boost/detail/lightweight_test.hpp>
  13. int main(int, char*[])
  14. {
  15. boost::uuids::random_generator gen;
  16. boost::uuids::uuid u1 = gen();
  17. boost::uuids::uuid u2 = gen();
  18. boost::uuids::uuid u3 = gen();
  19. std::map<boost::uuids::uuid, int> uuid_map;
  20. uuid_map[u1] = 1;
  21. uuid_map[u2] = 2;
  22. uuid_map[u3] = 3;
  23. BOOST_TEST_EQ(1, uuid_map[u1]);
  24. BOOST_TEST_EQ(2, uuid_map[u2]);
  25. BOOST_TEST_EQ(3, uuid_map[u3]);
  26. return boost::report_errors();
  27. }