primitives_tests.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*=============================================================================
  2. Phoenix V1.2.1
  3. Copyright (c) 2001-2003 Joel de Guzman
  4. Use, modification and distribution is subject to the Boost Software
  5. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #include <iostream>
  9. #include <boost/detail/lightweight_test.hpp>
  10. #define PHOENIX_LIMIT 15
  11. #include <boost/spirit/include/phoenix1_primitives.hpp>
  12. using namespace phoenix;
  13. using namespace std;
  14. ///////////////////////////////////////////////////////////////////////////////
  15. int
  16. main()
  17. {
  18. char c1 = '1';
  19. int i1 = 1, i2 = 2, i = 4;
  20. const char* s2 = "2";
  21. ///////////////////////////////////////////////////////////////////////////////
  22. //
  23. // Values, variables and arguments
  24. //
  25. ///////////////////////////////////////////////////////////////////////////////
  26. cout << val("Hello")() << val(' ')() << val("World")() << endl;
  27. BOOST_TEST(arg1(c1) == c1);
  28. BOOST_TEST(arg1(i1, i2) == i1);
  29. BOOST_TEST(arg2(i1, s2) == s2);
  30. BOOST_TEST(val(3)() == 3);
  31. BOOST_TEST(var(i)() == 4);
  32. BOOST_TEST(var(++i)() == 5);
  33. return boost::report_errors();
  34. }