Skip to content

Commit

Permalink
Remove remaining uses of Boost.Test
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Nov 13, 2018
1 parent 3bc2478 commit bfb0e47
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 43 deletions.
8 changes: 5 additions & 3 deletions test/contains_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/ref.hpp>

#define BOOST_CHECK BOOST_TEST

static int forty_two() { return 42; }

struct Seventeen
Expand Down Expand Up @@ -225,11 +227,11 @@ static void ref_equal_test()
#endif
}

int test_main(int, char*[])
int main()
{
target_test();
equal_test();
ref_equal_test();

return 0;
return boost::report_errors();
}
8 changes: 5 additions & 3 deletions test/function_n_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@

// For more information, see http://www.boost.org

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <boost/core/lightweight_test.hpp>
#include <functional>
#include <cassert>
#include <string>

#define BOOST_CHECK BOOST_TEST

using namespace boost;
using std::string;
using std::negate;
Expand Down Expand Up @@ -684,7 +686,7 @@ void test_construct_destroy_count()
BOOST_CHECK(construction_count == destruction_count);
}

int test_main(int, char* [])
int main()
{
test_zero_args();
test_one_arg();
Expand All @@ -693,5 +695,5 @@ int test_main(int, char* [])
test_member_functions();
test_ref();
test_construct_destroy_count();
return 0;
return boost::report_errors();
}
8 changes: 5 additions & 3 deletions test/function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@

// For more information, see http://www.boost.org

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <boost/core/lightweight_test.hpp>
#include <functional>
#include <string>
#include <utility>

#define BOOST_CHECK BOOST_TEST

using boost::function;
using std::string;

Expand Down Expand Up @@ -792,7 +794,7 @@ static void test_move_semantics()
#endif
}

int test_main(int, char* [])
int main()
{
test_zero_args();
test_one_arg();
Expand All @@ -807,5 +809,5 @@ int test_main(int, char* [])
test_move_semantics<function<void()> >();
test_move_semantics<boost::function0<void> >();

return 0;
return boost::report_errors();
}
18 changes: 4 additions & 14 deletions test/function_test_fail1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,12 @@

// For more information, see http://www.boost.org

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>

using namespace std;
using namespace boost;

int
test_main(int, char*[])
void test()
{
function0<int> f1;
function0<int> f2;

if (f1 == f2) {
}

BOOST_ERROR("This should not have compiled.");
boost::function0<int> f1;
boost::function0<int> f2;

return 0;
if( f1 == f2 ) {}
}
15 changes: 3 additions & 12 deletions test/function_test_fail2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@

// For more information, see http://www.boost.org

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>

using namespace std;
using namespace boost;

static int bad_fn(float f) { return static_cast<int>(f); }

int
test_main(int, char*[])
void test()
{
function0<int> f1;
f1 = bad_fn;

BOOST_ERROR("This should not have compiled.");

return 0;
boost::function0<int> f1;
f1 = bad_fn;
}
8 changes: 5 additions & 3 deletions test/nothrow_swap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

// For more information, see http://www.boost.org

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <boost/core/lightweight_test.hpp>

#define BOOST_CHECK BOOST_TEST

struct tried_to_copy { };

Expand Down Expand Up @@ -40,7 +42,7 @@ struct MaybeThrowOnCopy {

bool MaybeThrowOnCopy::throwOnCopy = false;

int test_main(int, char* [])
int main()
{
boost::function0<int> f;
boost::function0<int> g;
Expand All @@ -56,5 +58,5 @@ int test_main(int, char* [])
BOOST_CHECK(f() == 2);
BOOST_CHECK(g() == 1);

return 0;
return boost::report_errors();
}
11 changes: 6 additions & 5 deletions test/rvalues_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

// For more information, see http://www.boost.org

#include <boost/function.hpp>
#include <boost/move/move.hpp>
#include <boost/core/lightweight_test.hpp>
#include <iostream>
#include <cstdlib>

#include <boost/test/minimal.hpp>
#include <boost/function.hpp>
#include <boost/move/move.hpp>
#define BOOST_CHECK BOOST_TEST

class only_movable {
private:
Expand Down Expand Up @@ -63,7 +64,7 @@ int three(std::string&&) { return 1; }
std::string&& four(std::string&& s) { return boost::move(s); }
#endif

int test_main(int, char*[])
int main()
{
using boost::function;

Expand Down Expand Up @@ -102,5 +103,5 @@ int test_main(int, char*[])
BOOST_CHECK(f4(std::string("world")) == "world");
#endif

return 0;
return boost::report_errors();
}

0 comments on commit bfb0e47

Please sign in to comment.