dataset_example64.run-fail.cpp 1.0 KB

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