diff --git a/doc/examples/example59.cpp b/doc/examples/example59.cpp index b956416c..f6c52c59 100644 --- a/doc/examples/example59.cpp +++ b/doc/examples/example59.cpp @@ -6,24 +6,24 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example59 #include #include #include namespace bdata = boost::unit_test::data; -BOOST_DATA_TEST_CASE( test_case_snippet_1, bdata::xrange(5) ) +BOOST_DATA_TEST_CASE( test1, bdata::xrange(5) ) { std::cout << "test 1 " << sample << std::endl; - BOOST_CHECK(sample <= 4 && sample >= 0); + BOOST_TEST((sample <= 4 && sample >= 0)); } BOOST_DATA_TEST_CASE( - test_case_snippet_2, + test2, bdata::xrange( (bdata::begin=1, bdata::end=10, bdata::step=3)) ) { std::cout << "test 2 " << sample << std::endl; - BOOST_CHECK(sample <= 4 && sample >= 0); + BOOST_TEST((sample <= 4 && sample >= 0)); } //] diff --git a/doc/examples/example63.cpp b/doc/examples/example63.cpp index 8242ad3c..efb666f9 100644 --- a/doc/examples/example63.cpp +++ b/doc/examples/example63.cpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example63 #include #include #include @@ -19,8 +19,9 @@ BOOST_DATA_TEST_CASE( bdata::random(1, 17) ^ bdata::xrange(7), random_sample, index ) { - std::cout << "test 1 " << random_sample << std::endl; - BOOST_CHECK(random_sample <= 17 && random_sample >= 1); + std::cout << "test 1 " << random_sample + << "," << index << std::endl; + BOOST_TEST((random_sample <= 17 && random_sample >= 1)); } BOOST_DATA_TEST_CASE( @@ -29,7 +30,8 @@ BOOST_DATA_TEST_CASE( ^ bdata::xrange(7), random_sample, index ) { - std::cout << "test 2 " << random_sample << std::endl; + std::cout << "test 2 " << random_sample + << "," << index << std::endl; BOOST_CHECK(random_sample < 1.7); // 30% chance of failure } //] diff --git a/doc/examples/example64.cpp b/doc/examples/example64.cpp index de95a3e6..373e25f8 100644 --- a/doc/examples/example64.cpp +++ b/doc/examples/example64.cpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example64 #include #include #include @@ -15,16 +15,16 @@ namespace bdata = boost::unit_test::data; BOOST_DATA_TEST_CASE( - test_case_snippet_1, + test1, bdata::xrange(2) * bdata::xrange(3), xr1, xr2) { std::cout << "test 1: " << xr1 << ", " << xr2 << std::endl; - BOOST_CHECK(xr1 <= 2 && xr2 <= 3); + BOOST_TEST((xr1 <= 2 && xr2 <= 3)); } BOOST_DATA_TEST_CASE( - test_case_snippet_2, + test2, bdata::xrange(3) * ( bdata::random( @@ -37,6 +37,6 @@ BOOST_DATA_TEST_CASE( << xr << " / " << random_sample << ", " << index << std::endl; - BOOST_CHECK(random_sample < 1.7); // 30% chance of failure + BOOST_TEST(random_sample < 1.7); // 30% chance of failure } //] diff --git a/doc/examples/example65.cpp b/doc/examples/example65.cpp index 58460100..cb43b083 100644 --- a/doc/examples/example65.cpp +++ b/doc/examples/example65.cpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example65 #include #include #include @@ -15,24 +15,24 @@ namespace bdata = boost::unit_test::data; BOOST_DATA_TEST_CASE( - test_case_snippet_1, + test1, bdata::make(2), singleton) { std::cout << "test 1: " << singleton << std::endl; - BOOST_CHECK(singleton == 2); + BOOST_TEST(singleton == 2); } BOOST_DATA_TEST_CASE( - test_case_snippet_2, + test2, bdata::xrange(3) ^ bdata::make(2), xr, singleton) { std::cout << "test 2: " << xr << ", " << singleton << std::endl; - BOOST_CHECK(singleton == 2); + BOOST_TEST(singleton == 2); } //] diff --git a/doc/examples/example66.cpp b/doc/examples/example66.cpp index 3af2cde9..66f2ea20 100644 --- a/doc/examples/example66.cpp +++ b/doc/examples/example66.cpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example66 #include #include #include @@ -16,7 +16,7 @@ namespace bdata = boost::unit_test::data; const char* arr[] = {"cat", "dog"}; BOOST_DATA_TEST_CASE( - test_case_snippet_1, + test1, bdata::xrange(2) ^ bdata::make(arr), xr, array_element) { @@ -24,6 +24,6 @@ BOOST_DATA_TEST_CASE( << xr << ", " << array_element << std::endl; - BOOST_CHECK(array_element != std::string("mammoth")); + BOOST_TEST(array_element != "mammoth"); } //] diff --git a/doc/examples/example67.cpp b/doc/examples/example67.cpp index 46287986..5ff55e1b 100644 --- a/doc/examples/example67.cpp +++ b/doc/examples/example67.cpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. //[example_code -#define BOOST_TEST_MAIN +#define BOOST_TEST_MODULE example67 #include #include #include @@ -28,14 +28,14 @@ std::vector fibonacci() { } BOOST_DATA_TEST_CASE( - test_case_snippet_1, + test1, bdata::make(fibonacci()), array_element) { std::cout << "test 1: " << array_element << std::endl; - BOOST_CHECK(array_element <= 13); + BOOST_TEST(array_element <= 13); } @@ -56,7 +56,7 @@ typedef std::pair pair_map_t; BOOST_TEST_DONT_PRINT_LOG_VALUE( pair_map_t ); BOOST_DATA_TEST_CASE( - test_case_snippet_2, + test2, bdata::make(vect_2_str(fibonacci())), array_element) { @@ -64,6 +64,6 @@ BOOST_DATA_TEST_CASE( << array_element.first << "\", " << array_element.second << std::endl; - BOOST_CHECK(array_element.second <= 13); + BOOST_TEST(array_element.second <= 13); } //] diff --git a/doc/examples/example67.output b/doc/examples/example67.output index cb0464f5..2ee49ed1 100644 --- a/doc/examples/example67.output +++ b/doc/examples/example67.output @@ -1,5 +1,5 @@ //[example_output ->example +> example67 Running 15 test cases... test 1: 0 test 1: 1 diff --git a/doc/snippet/dataset_1/test_file.cpp b/doc/snippet/dataset_1/test_file.cpp index 4fe532ce..40d3d616 100644 --- a/doc/snippet/dataset_1/test_file.cpp +++ b/doc/snippet/dataset_1/test_file.cpp @@ -11,26 +11,25 @@ namespace data=boost::unit_test::data; -#if 0 //[snippet_dataset1_1 BOOST_DATA_TEST_CASE( test_case_arity1_implicit, data::xrange(5) ) { - BOOST_CHECK(sample <= 4 && sample >= 0); + BOOST_TEST((sample <= 4 && sample >= 0)); } //] //[snippet_dataset1_2 BOOST_DATA_TEST_CASE( test_case_arity1, data::xrange(5), my_var ) { - BOOST_CHECK(my_var <= 4 && my_var >= 0); + BOOST_TEST((my_var <= 4 && my_var >= 0)); } //] //[snippet_dataset1_3 BOOST_DATA_TEST_CASE( test_case_arity2, data::xrange(2) ^ data::xrange(5), apples, potatoes) { - BOOST_CHECK(apples <= 1 && apples >= 0); - BOOST_CHECK(potatoes <= 4 && potatoes >= 0); + BOOST_TEST((apples <= 1 && apples >= 0)); + BOOST_TEST((potatoes <= 4 && potatoes >= 0)); } //] @@ -55,8 +54,6 @@ BOOST_DATA_TEST_CASE( test_case_3, data::make(v), var1) } //] -#endif - #include #include @@ -77,7 +74,7 @@ const std::vector v = generate_vector(); BOOST_DATA_TEST_CASE( test_case_1, data::make(v), var1) { std::cout << var1 << std::endl; - BOOST_CHECK(true); + BOOST_TEST(true); } @@ -96,5 +93,5 @@ const std::map m = generate_map(); BOOST_DATA_TEST_CASE( test_case_2, data::make(m), var1) { std::cout << var1.first << " -- " << var1.second << std::endl; - BOOST_CHECK(true); + BOOST_TEST(true); } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index bf76f3f5..410830b1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -152,6 +152,7 @@ test-suite "unit_test_framework_test" # examples in datasets + [ test-btl-lib-c11 run : example67 : : : ../doc/examples/example67.cpp ] [ test-btl-lib-c11 run-fail : example68 : : : ../doc/examples/example68.cpp ] ;