/Src/Dependencies/Boost/libs/parameter/test/singular.cpp

http://hadesmem.googlecode.com/ · C++ · 42 lines · 29 code · 10 blank · 3 comment · 2 complexity · 93f0d6d1f085106c0e03282cbab400f1 MD5 · raw file

  1. // Copyright Daniel Wallin 2005. Use, modification and distribution is
  2. // subject to the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/parameter/keyword.hpp>
  5. #include <boost/detail/lightweight_test.hpp>
  6. BOOST_PARAMETER_KEYWORD(tag, x)
  7. BOOST_PARAMETER_KEYWORD(tag, y)
  8. struct default_src
  9. {
  10. typedef int result_type;
  11. int operator()() const
  12. {
  13. return 0;
  14. }
  15. };
  16. template <class ArgumentPack, class K, class T>
  17. void check(ArgumentPack const& p, K const& kw, T const& value)
  18. {
  19. BOOST_TEST(p[kw] == value);
  20. }
  21. int main()
  22. {
  23. check(x = 20, x, 20);
  24. check(y = 20, y, 20);
  25. check(x = 20, x | 0, 20);
  26. check(y = 20, y | 0, 20);
  27. check(x = 20, x | default_src(), 20);
  28. check(y = 20, y | default_src(), 20);
  29. check(y = 20, x | 0, 0);
  30. check(y = 20, x || default_src(), 0);
  31. return boost::report_errors();
  32. }