mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 05:07:21 +02:00
Switched to <boost/detail/lightweight_test.hpp> for testing.
[SVN r14932]
This commit is contained in:
@ -19,9 +19,6 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#define BOOST_INCLUDE_MAIN
|
|
||||||
#include <boost/test/test_tools.hpp>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
@ -153,7 +150,7 @@ int const m = 16; // threads
|
|||||||
char const * implementation = "spinlock";
|
char const * implementation = "spinlock";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int test_main( int, char ** )
|
int main()
|
||||||
{
|
{
|
||||||
std::printf("%s: %s, %d threads, %d iterations: ", title, implementation, m, n);
|
std::printf("%s: %s, %d threads, %d iterations: ", title, implementation, m, n);
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
// warranty, and with no claim as to its suitability for any purpose.
|
// warranty, and with no claim as to its suitability for any purpose.
|
||||||
//
|
//
|
||||||
|
|
||||||
#define BOOST_INCLUDE_MAIN
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/weak_ptr.hpp>
|
#include <boost/weak_ptr.hpp>
|
||||||
@ -197,7 +196,7 @@ template<class T> void test_is_nonzero(boost::shared_ptr<T> const & p)
|
|||||||
BOOST_TEST(p.get() != 0);
|
BOOST_TEST(p.get() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_main(int, char * [])
|
int main()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
@ -369,5 +368,5 @@ int test_main(int, char * [])
|
|||||||
|
|
||||||
BOOST_TEST(cnt == 0);
|
BOOST_TEST(cnt == 0);
|
||||||
|
|
||||||
return 0;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/shared_array.hpp>
|
#include <boost/shared_array.hpp>
|
||||||
|
|
||||||
#define BOOST_INCLUDE_MAIN
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -84,12 +83,11 @@ Incomplete * check_incomplete( shared_ptr<Incomplete>& incomplete,
|
|||||||
cout << incomplete.use_count() << ' ' << incomplete.unique() << '\n';
|
cout << incomplete.use_count() << ' ' << incomplete.unique() << '\n';
|
||||||
return incomplete.get();
|
return incomplete.get();
|
||||||
}
|
}
|
||||||
// main --------------------------------------------------------------------//
|
|
||||||
|
|
||||||
// This isn't a very systematic test; it just hits some of the basics.
|
// This isn't a very systematic test; it just hits some of the basics.
|
||||||
|
|
||||||
int test_main( int, char *[] ) {
|
void test()
|
||||||
|
{
|
||||||
BOOST_TEST( UDT_use_count == 0 ); // reality check
|
BOOST_TEST( UDT_use_count == 0 ); // reality check
|
||||||
|
|
||||||
// test scoped_ptr with a built-in type
|
// test scoped_ptr with a built-in type
|
||||||
@ -289,7 +287,10 @@ int test_main( int, char *[] ) {
|
|||||||
cout << "OK\n";
|
cout << "OK\n";
|
||||||
|
|
||||||
new char[12345]; // deliberate memory leak to verify leaks detected
|
new char[12345]; // deliberate memory leak to verify leaks detected
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
int main()
|
||||||
} // main
|
{
|
||||||
|
test();
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user