boost_runtime_list_content.run.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // (C) Copyright 2015 Boost.Test team.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //[example_code
  7. #define BOOST_TEST_MODULE list_content
  8. #include <boost/test/included/unit_test.hpp>
  9. namespace utf=boost::unit_test;
  10. //// --------------------------------------------------------------------------
  11. // Test suite 1, disabled by default, s1/test2 is explicitely enabled.
  12. BOOST_AUTO_TEST_SUITE( s1,
  13. * utf::disabled() // suite is not disabled because of the
  14. * utf::description( "disabled suite 1") // extra declaration at the end of the file
  15. * utf::label( "label1" )
  16. * utf::label( "label2" ))
  17. BOOST_AUTO_TEST_CASE( test1, // s1/test1
  18. * utf::enabled() * utf::description("enabled"))
  19. {
  20. BOOST_TEST(true);
  21. }
  22. BOOST_AUTO_TEST_CASE( test2, // s1/test2
  23. * utf::description( "defaulted") * utf::expected_failures( 1 ))
  24. {
  25. BOOST_TEST(false);
  26. }
  27. BOOST_AUTO_TEST_CASE( test3, // s1/test3
  28. * utf::description( "defaulted"))
  29. {
  30. BOOST_TEST(false);
  31. }
  32. BOOST_AUTO_TEST_SUITE_END()
  33. //// --------------------------------------------------------------------------
  34. // Test suite 2, disabled by default, s2/test2 is explicitely enabled.
  35. BOOST_AUTO_TEST_SUITE( s2,
  36. * utf::disabled()
  37. * utf::label( "label1" )
  38. * utf::expected_failures( 3 ))
  39. BOOST_AUTO_TEST_CASE( test1, // s2/test1
  40. * utf::description( "defaulted"))
  41. {
  42. BOOST_TEST(false);
  43. }
  44. boost::test_tools::assertion_result do_it( utf::test_unit_id )
  45. {
  46. return false;
  47. }
  48. BOOST_AUTO_TEST_CASE( test2, // s2/test2
  49. * utf::enabled()
  50. * utf::description( "enabled w. precondition")
  51. * utf::precondition(do_it))
  52. {
  53. BOOST_TEST(false);
  54. }
  55. //// --------------------------------------------------------------------------
  56. // Test suite s2/s23, disabled
  57. BOOST_AUTO_TEST_SUITE( s23, * utf::disabled())
  58. BOOST_AUTO_TEST_CASE( test1 ) // s2/s23/test1
  59. {
  60. BOOST_TEST(false);
  61. }
  62. BOOST_AUTO_TEST_CASE( test2, // s2/s23/test2
  63. * utf::timeout( 10 ))
  64. {
  65. BOOST_TEST( true );
  66. }
  67. BOOST_AUTO_TEST_CASE( test3, // s2/s23/test3
  68. * utf::enabled()
  69. * utf::depends_on( "s2/test2" ))
  70. {
  71. BOOST_TEST( true );
  72. }
  73. BOOST_AUTO_TEST_SUITE_END() // s2/s23
  74. BOOST_AUTO_TEST_SUITE_END() // s2
  75. //// --------------------------------------------------------------------------
  76. // Test suite s1 continued
  77. BOOST_AUTO_TEST_SUITE( s1 )
  78. BOOST_AUTO_TEST_SUITE( s14,
  79. * utf::depends_on( "s2/s23/test3" )
  80. * utf::description( "test suite which depends on another test suite"))
  81. BOOST_AUTO_TEST_CASE( test1, // s1/s14/test1
  82. * utf::depends_on( "s2" ))
  83. {
  84. BOOST_TEST( "s14" == "test" );
  85. }
  86. BOOST_AUTO_TEST_SUITE_END() // s1/s14
  87. BOOST_AUTO_TEST_SUITE_END() // s1
  88. //]