lazy_list2_tests.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ////////////////////////////////////////////////////////////////////////////
  2. // lazy_list2_tests.cpp
  3. //
  4. // more tests on list<T>
  5. //
  6. ////////////////////////////////////////////////////////////////////////////
  7. /*=============================================================================
  8. Copyright (c) 2000-2003 Brian McNamara and Yannis Smaragdakis
  9. Copyright (c) 2001-2007 Joel de Guzman
  10. Copyright (c) 2015 John Fletcher
  11. Distributed under the Boost Software License, Version 1.0. (See accompanying
  12. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  13. ==============================================================================*/
  14. #include <boost/phoenix/core/limits.hpp>
  15. #include <boost/detail/lightweight_test.hpp>
  16. #include <boost/phoenix/core.hpp>
  17. #include <boost/phoenix/function/lazy_prelude.hpp>
  18. int main()
  19. {
  20. namespace phx = boost::phoenix;
  21. using boost::phoenix::arg_names::arg1;
  22. using boost::phoenix::arg_names::arg2;
  23. using namespace phx;
  24. list<int> l0;
  25. list<int> l1 = list_with<>()(1,2,3,4,5);
  26. list<int> l2 = all_but_last(l1)();
  27. BOOST_TEST(null(l0)());
  28. BOOST_TEST(head(l1)() == 1);
  29. BOOST_TEST(head(tail(l1))() == 2);
  30. BOOST_TEST(last(l1)() == 5);
  31. BOOST_TEST(last(l2)() == 4);
  32. BOOST_TEST(head(drop(2,l2))() == 3);
  33. return boost::report_errors();
  34. }