• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  (C) Copyright Raffi Enficiaud 2014.
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 
6 //  See http://www.boost.org/libs/test for the library home page.
7 
8 //[example_code
9 #define BOOST_TEST_MODULE dataset_example64
10 #include <boost/test/included/unit_test.hpp>
11 #include <boost/test/data/test_case.hpp>
12 #include <boost/test/data/monomorphic.hpp>
13 
14 namespace bdata = boost::unit_test::data;
15 
16 
17 BOOST_DATA_TEST_CASE(
18   test1,
19   bdata::xrange(2) * bdata::xrange(3),
20   xr1, xr2)
21 {
22   std::cout << "test 1: " << xr1 << ", " << xr2 << std::endl;
23   BOOST_TEST((xr1 <= 2 && xr2 <= 3));
24 }
25 
26 BOOST_DATA_TEST_CASE(
27   test2,
28   bdata::xrange(3)
29   *
30   ( bdata::random(
31       bdata::distribution=std::uniform_real_distribution<float>(1, 2))
32     ^ bdata::xrange(2)
33   ),
34   xr, random_sample, index)
35 {
36   std::cout << "test 2: "
37     << xr << " / "
38     << random_sample << ", " << index
39     << std::endl;
40   BOOST_TEST(random_sample < 1.7); // 30% chance of failure
41 }
42 //]
43