/Src/Dependencies/Boost/libs/mpl/test/list.cpp

http://hadesmem.googlecode.com/ · C++ · 68 lines · 43 code · 15 blank · 10 comment · 0 complexity · 1ce5d3b20a6548feb67bc4bbb910bd75 MD5 · raw file

  1. // Copyright Aleksey Gurtovoy 2000-2004
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/mpl for documentation.
  8. // $Id: list.cpp 49268 2008-10-11 06:26:17Z agurtovoy $
  9. // $Date: 2008-10-11 17:26:17 +1100 (Sat, 11 Oct 2008) $
  10. // $Revision: 49268 $
  11. #include <boost/mpl/list.hpp>
  12. #include <boost/mpl/push_front.hpp>
  13. #include <boost/mpl/pop_front.hpp>
  14. #include <boost/mpl/front.hpp>
  15. #include <boost/mpl/size.hpp>
  16. #include <boost/mpl/empty.hpp>
  17. #include <boost/mpl/aux_/test.hpp>
  18. MPL_TEST_CASE()
  19. {
  20. typedef list0<> l0;
  21. typedef list1<char> l1;
  22. typedef list2<char,long> l2;
  23. typedef list9<char,char,char,char,char,char,char,char,char> l9;
  24. MPL_ASSERT_RELATION(size<l0>::value, ==, 0);
  25. MPL_ASSERT_RELATION(size<l1>::value, ==, 1);
  26. MPL_ASSERT_RELATION(size<l2>::value, ==, 2);
  27. MPL_ASSERT_RELATION(size<l9>::value, ==, 9);
  28. MPL_ASSERT(( empty<l0> ));
  29. MPL_ASSERT_NOT(( empty<l1> ));
  30. MPL_ASSERT_NOT(( empty<l2> ));
  31. MPL_ASSERT_NOT(( empty<l9> ));
  32. MPL_ASSERT(( is_same<front<l1>::type,char> ));
  33. MPL_ASSERT(( is_same<front<l2>::type,char> ));
  34. MPL_ASSERT(( is_same<front<l9>::type,char> ));
  35. }
  36. MPL_TEST_CASE()
  37. {
  38. typedef list2<char,long> l2;
  39. typedef begin<l2>::type i1;
  40. typedef next<i1>::type i2;
  41. typedef next<i2>::type i3;
  42. MPL_ASSERT(( is_same<deref<i1>::type,char> ));
  43. MPL_ASSERT(( is_same<deref<i2>::type,long> ));
  44. MPL_ASSERT(( is_same< i3, end<l2>::type > ));
  45. }
  46. MPL_TEST_CASE()
  47. {
  48. typedef list0<> l0;
  49. typedef push_front<l0,char>::type l1;
  50. MPL_ASSERT(( is_same<front<l1>::type,char> ));
  51. typedef push_front<l1,long>::type l2;
  52. MPL_ASSERT(( is_same<front<l2>::type,long> ));
  53. }