test_ambiguous_set.cpp 885 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // Copyright (C) 2018 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/dynamic_bitset.hpp>
  14. #include <boost/core/lightweight_test.hpp>
  15. int main(int, char*[])
  16. {
  17. boost::dynamic_bitset<> x(5); // all 0's by default
  18. x.set(1, 2);
  19. x.set(3, 1, true);
  20. x.set(2, 1, false);
  21. BOOST_TEST(!x.test(0));
  22. BOOST_TEST( x.test(1));
  23. BOOST_TEST(!x.test(2));
  24. BOOST_TEST( x.test(3));
  25. BOOST_TEST(!x.test(4));
  26. return boost::report_errors();
  27. }