Skip to content

Commit 09e789b

Browse files
committed
Remove all uses of Boost.Test.
1 parent a307fd7 commit 09e789b

File tree

14 files changed

+281
-58
lines changed

14 files changed

+281
-58
lines changed

test/c_compiler_checks/posix_api_check.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <string.h>
2222
#include <boost/assert.hpp>
2323
#include <boost/regex.h>
24-
#include <boost/detail/lightweight_test.hpp>
24+
#include "../test_macros.hpp"
2525

2626
const char* expression = "^";
2727
const char* text = "\n ";
@@ -43,7 +43,7 @@ int main()
4343
printf("%s", buf);
4444
return result;
4545
}
46-
BOOST_TEST(re.re_nsub == 0);
46+
BOOST_CHECK(re.re_nsub == 0);
4747
matches[0].rm_so = 0;
4848
matches[0].rm_eo = strlen(text);
4949
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
@@ -55,7 +55,7 @@ int main()
5555
regfreeA(&re);
5656
return result;
5757
}
58-
BOOST_TEST(matches[0].rm_so == matches[0].rm_eo);
58+
BOOST_CHECK(matches[0].rm_so == matches[0].rm_eo);
5959
regfreeA(&re);
6060
printf("no errors found\n");
6161
return boost::report_errors();

test/c_compiler_checks/wide_posix_api_check.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <stdlib.h>
2727
#include <boost/regex.h>
2828
#include <wchar.h>
29+
#include <iostream>
30+
#include <iomanip>
2931

3032
#ifndef BOOST_NO_WREGEX
3133

test/captures/captures_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
*/
1818

1919
#include <boost/regex.hpp>
20-
#include <boost/test/test_tools.hpp>
20+
#include <boost/detail/lightweight_main.hpp>
21+
#include "../test_macros.hpp"
2122
#include <boost/array.hpp>
2223

2324
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
@@ -50,7 +51,7 @@ void test_captures(const std::string& regx, const std::string& text, T& expected
5051
}
5152
}
5253

53-
int test_main(int , char* [])
54+
int cpp_main(int , char* [])
5455
{
5556
typedef const char* pchar;
5657
pchar e1[4][5] =
@@ -113,4 +114,3 @@ int test_main(int , char* [])
113114
return 0;
114115
}
115116

116-
#include <boost/test/included/test_exec_monitor.hpp>

test/collate_info/collate_info.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include <boost/regex.hpp>
1414
#include <boost/regex/v4/primary_transform.hpp>
1515
#include <assert.h>
16+
#include <boost/detail/lightweight_main.hpp>
17+
#include <iostream>
18+
#include <iomanip>
1619

1720
#ifdef BOOST_INTEL
1821
#pragma warning(disable:1418 981 983 2259)
@@ -250,4 +253,3 @@ int cpp_main(int /*argc*/, char * /*argv*/[])
250253
return 0;
251254
}
252255

253-
#include <boost/test/included/prg_exec_monitor.hpp>

test/named_subexpressions/named_subexpressions_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
*/
1111

1212
#include <boost/regex.hpp>
13-
#include <boost/test/test_tools.hpp>
13+
#include <boost/detail/lightweight_main.hpp>
14+
#include "../test_macros.hpp"
1415

1516
#ifdef BOOST_INTEL
1617
#pragma warning(disable:1418 981 983 383)
@@ -102,11 +103,10 @@ void test_named_subexpressions(charT)
102103
}
103104
}
104105

105-
int test_main( int , char* [] )
106+
int cpp_main( int , char* [] )
106107
{
107108
test_named_subexpressions(char(0));
108109
test_named_subexpressions(wchar_t(0));
109110
return 0;
110111
}
111112

112-
#include <boost/test/included/test_exec_monitor.hpp>

test/object_cache/object_cache_test.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
* DESCRIPTION: Test code for a generic object cache.
1717
*/
1818
#include <boost/regex/pending/object_cache.hpp>
19-
#include <boost/test/included/test_exec_monitor.hpp>
19+
#include <boost/detail/lightweight_main.hpp>
20+
#include "../test_macros.hpp"
2021

2122
class test_object
2223
{
@@ -43,7 +44,7 @@ int test_object::s_count = 0;
4344

4445
static const int max_cache_size = 5;
4546

46-
int test_main(int /*argc*/, char * /*argv*/[])
47+
int cpp_main(int /*argc*/, char * /*argv*/[])
4748
{
4849
int i;
4950
for(i = 0; i < 20; ++i)
@@ -73,6 +74,4 @@ int test_main(int /*argc*/, char * /*argv*/[])
7374
return 0;
7475
}
7576

76-
#include <boost/test/included/test_exec_monitor.hpp>
77-
7877

test/pathology/bad_expression_test.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
#include <string>
2020
#include <boost/regex.hpp>
21-
#include <boost/test/test_tools.hpp>
21+
#include <boost/detail/lightweight_main.hpp>
22+
#include "../test_macros.hpp"
2223

2324
#ifdef BOOST_INTEL
2425
#pragma warning(disable:1418 981 983 383)
2526
#endif
2627

27-
int test_main( int , char* [] )
28+
int cpp_main( int , char* [] )
2829
{
2930
std::string bad_text(1024, ' ');
3031
std::string good_text(200, ' ');
@@ -57,5 +58,3 @@ int test_main( int , char* [] )
5758
return 0;
5859
}
5960

60-
#include <boost/test/included/test_exec_monitor.hpp>
61-

test/pathology/recursion_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
#include <string>
2020
#include <boost/regex.hpp>
21-
#include <boost/test/test_tools.hpp>
21+
#include <boost/detail/lightweight_main.hpp>
22+
#include "../test_macros.hpp"
2223

2324
#ifdef BOOST_INTEL
2425
#pragma warning(disable:1418 981 983 383)
2526
#endif
2627

27-
int test_main( int , char* [] )
28+
int cpp_main( int , char* [] )
2829
{
2930
// this regex will recurse twice for each whitespace character matched:
3031
boost::regex e("([[:space:]]|.)+");
@@ -62,4 +63,3 @@ int test_main( int , char* [] )
6263
return 0;
6364
}
6465

65-
#include <boost/test/included/test_exec_monitor.hpp>

test/regress/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "test.hpp"
2020
#include "test_locale.hpp"
2121
#include <stdarg.h>
22+
#include <iostream>
23+
#include <iomanip>
2224

2325
#ifdef BOOST_HAS_ICU
2426
#include <unicode/uloc.h>
@@ -232,6 +234,6 @@ int main(int argc, char * argv[])
232234

233235
#else
234236

235-
#include <boost/test/included/prg_exec_monitor.hpp>
237+
#include <boost/detail/lightweight_main.hpp>
236238

237239
#endif

test/regress/test_locale.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <boost/scoped_array.hpp>
1616
#include <windows.h>
1717
#endif
18+
#include <iostream>
19+
#include <iomanip>
1820

1921
#ifdef BOOST_MSVC
2022
#pragma warning(disable:4127)

test/regress/test_operators.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*/
1111

1212
#include "test.hpp"
13+
#include <iostream>
14+
#include <iomanip>
1315

1416
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)\
1517
&& !BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500))\

test/static_mutex/static_mutex_test.cpp

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
*/
1818

1919
#include <iostream>
20+
#include <iomanip>
2021
#include <boost/regex/pending/static_mutex.hpp>
2122
#include <boost/thread/thread.hpp>
2223
#include <boost/timer.hpp>
2324

2425
//
2526
// we cannot use the regular Boost.Test in here: it is not thread safe
26-
// and calls to BOOST_TEST will eventually crash on some compilers
27+
// and calls to BOOST_CHECK will eventually crash on some compilers
2728
// (Borland certainly) due to race conditions inside the Boost.Test lib.
2829
//
29-
#define BOOST_TEST(pred) if(!(pred)) failed_test(__FILE__, __LINE__, BOOST_STRINGIZE(pred));
30+
#define BOOST_CHECK(pred) if(!(pred)) failed_test(__FILE__, __LINE__, BOOST_STRINGIZE(pred));
3031

3132
int total_failures = 0;
3233
void failed_test(const char* file, int line, const char* pred)
@@ -62,11 +63,11 @@ bool t1()
6263
static int data = 10000;
6364

6465
boost::static_mutex::scoped_lock guard(mut);
65-
BOOST_TEST(++has_lock == 1);
66-
BOOST_TEST(guard.locked());
67-
BOOST_TEST(guard);
66+
BOOST_CHECK(++has_lock == 1);
67+
BOOST_CHECK(guard.locked());
68+
BOOST_CHECK(guard);
6869
bool result = (--data > 0) ? true : false;
69-
BOOST_TEST(--has_lock == 0);
70+
BOOST_CHECK(--has_lock == 0);
7071
return result;
7172
}
7273

@@ -77,17 +78,17 @@ bool t2()
7778
static int data = 10000;
7879

7980
boost::static_mutex::scoped_lock guard(mut, false);
80-
BOOST_TEST(0 == guard.locked());
81-
BOOST_TEST(!guard);
81+
BOOST_CHECK(0 == guard.locked());
82+
BOOST_CHECK(!guard);
8283
guard.lock();
83-
BOOST_TEST(++has_lock == 1);
84-
BOOST_TEST(guard.locked());
85-
BOOST_TEST(guard);
84+
BOOST_CHECK(++has_lock == 1);
85+
BOOST_CHECK(guard.locked());
86+
BOOST_CHECK(guard);
8687
bool result = (--data > 0) ? true : false;
87-
BOOST_TEST(--has_lock == 0);
88+
BOOST_CHECK(--has_lock == 0);
8889
guard.unlock();
89-
BOOST_TEST(0 == guard.locked());
90-
BOOST_TEST(!guard);
90+
BOOST_CHECK(0 == guard.locked());
91+
BOOST_CHECK(!guard);
9192
return result;
9293
}
9394

@@ -98,11 +99,11 @@ bool t3()
9899
static int data = 10000;
99100

100101
boost::static_mutex::scoped_lock guard(mut);
101-
BOOST_TEST(++has_lock == 1);
102-
BOOST_TEST(guard.locked());
103-
BOOST_TEST(guard);
102+
BOOST_CHECK(++has_lock == 1);
103+
BOOST_CHECK(guard.locked());
104+
BOOST_CHECK(guard);
104105
bool result = (--data > 0) ? true : false;
105-
BOOST_TEST(--has_lock == 0);
106+
BOOST_CHECK(--has_lock == 0);
106107
return result;
107108
}
108109

0 commit comments

Comments
 (0)