| 1 | #include <iostream>
|
|---|
| 2 | #include <vector>
|
|---|
| 3 | #include <string>
|
|---|
| 4 |
|
|---|
| 5 | #define BOOST_TEST_MODULE Demo
|
|---|
| 6 | //XXX #define BOOST_TEST_NO_LIB
|
|---|
| 7 | #define BOOST_TEST_NO_MAIN
|
|---|
| 8 | #include <boost/test/included/unit_test.hpp>
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | BOOST_AUTO_TEST_CASE(QueuedThreadPoolLoad_test)
|
|---|
| 12 | {
|
|---|
| 13 | static int i(0);
|
|---|
| 14 |
|
|---|
| 15 | BOOST_TEST_MESSAGE("simple compare");
|
|---|
| 16 | BOOST_TEST(i == 0);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | #ifdef BOOST_TEST_NO_MAIN
|
|---|
| 21 | int
|
|---|
| 22 | main(int argc, char* argv[])
|
|---|
| 23 | {
|
|---|
| 24 | // prototype for user's unit test init function
|
|---|
| 25 | extern ::boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]);
|
|---|
| 26 | int loops = 1;
|
|---|
| 27 | int error = 0;
|
|---|
| 28 | boost::unit_test::init_unit_test_func init_func = &init_unit_test_suite;
|
|---|
| 29 | std::vector<std::string> args;
|
|---|
| 30 |
|
|---|
| 31 | if (argc > 1 && argv[argc - 1][0] == '-') {
|
|---|
| 32 | std::stringstream ss(argv[argc - 1] + 1);
|
|---|
| 33 | ss >> loops;
|
|---|
| 34 | if (!ss.fail()) {
|
|---|
| 35 | std::cout << "loops requested: " << loops << std::endl;
|
|---|
| 36 | --argc; // private args not for boost::unit_test! CK
|
|---|
| 37 | }
|
|---|
| 38 | for (int i = 0; i < argc; ++i) {
|
|---|
| 39 | args.push_back(std::string(argv[i]));
|
|---|
| 40 | std::cout << i << ": " << argv[i] << std::endl;
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | do {
|
|---|
| 45 | error = ::boost::unit_test::unit_test_main(init_func, argc, argv);
|
|---|
| 46 |
|
|---|
| 47 | if (--loops <= 0) {
|
|---|
| 48 | break;
|
|---|
| 49 | }
|
|---|
| 50 | for (int i = 0; i < argc; ++i) {
|
|---|
| 51 | strcpy(argv[i], args[i].c_str());
|
|---|
| 52 | std::cout << i << ": " << argv[i] << std::endl;
|
|---|
| 53 | }
|
|---|
| 54 | std::cout << "loops left: " << loops << std::endl;
|
|---|
| 55 | } while (!error);
|
|---|
| 56 |
|
|---|
| 57 | return error;
|
|---|
| 58 | }
|
|---|
| 59 | #endif
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|