test_std_hash.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Copyright (C) 2019 James E. King III
  3. //
  4. // Permission to copy, use, modify, sell and distribute this software
  5. // is granted provided this copyright notice appears in all copies.
  6. // This software is provided "as is" without express or implied
  7. // warranty, and with no claim as to its suitability for any purpose.
  8. //
  9. // Distributed under the Boost Software License, Version 1.0. (See
  10. // accompanying file LICENSE_1_0.txt or copy at
  11. // http://www.boost.org/LICENSE_1_0.txt)
  12. //
  13. #include <boost/config.hpp>
  14. #include <boost/dynamic_bitset.hpp>
  15. #include <boost/detail/lightweight_test.hpp>
  16. #include <functional>
  17. #include <unordered_set>
  18. int main(int, char*[])
  19. {
  20. typedef boost::dynamic_bitset<unsigned long> bitset_type;
  21. const std::string long_string =
  22. "01001110101110110101011010000000000011110101101111111111";
  23. bitset_type zeroes(long_string.size(), 0);
  24. bitset_type stuff (long_string);
  25. bitset_type ones (long_string.size(), 1);
  26. std::unordered_set<bitset_type> bitsets;
  27. bitsets.insert(zeroes);
  28. bitsets.insert(stuff);
  29. bitsets.insert(ones);
  30. BOOST_TEST_EQ(bitsets.size(), 3);
  31. return boost::report_errors();
  32. }