forked from boostorg/smart_ptr
make_unique tests run only for C++11 compilers
This commit is contained in:
@ -6,6 +6,8 @@
|
|||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_object.hpp>
|
#include <boost/smart_ptr/make_unique_object.hpp>
|
||||||
|
|
||||||
@ -40,7 +42,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
{
|
{
|
||||||
std::unique_ptr<type> a1 = boost::make_unique<type>();
|
std::unique_ptr<type> a1 = boost::make_unique<type>();
|
||||||
@ -132,8 +133,14 @@ int main() {
|
|||||||
a1.reset();
|
a1.reset();
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_array.hpp>
|
#include <boost/smart_ptr/make_unique_array.hpp>
|
||||||
|
|
||||||
@ -30,7 +31,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<int[]> a1 = boost::make_unique_noinit<int[]>(3);
|
std::unique_ptr<int[]> a1 = boost::make_unique_noinit<int[]>(3);
|
||||||
BOOST_TEST(a1.get() != 0);
|
BOOST_TEST(a1.get() != 0);
|
||||||
@ -76,7 +76,13 @@ int main() {
|
|||||||
a1.reset();
|
a1.reset();
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_array.hpp>
|
#include <boost/smart_ptr/make_unique_array.hpp>
|
||||||
|
|
||||||
@ -30,7 +31,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<int[]> a1 = boost::make_unique<int[]>(3);
|
std::unique_ptr<int[]> a1 = boost::make_unique<int[]>(3);
|
||||||
BOOST_TEST(a1.get() != 0);
|
BOOST_TEST(a1.get() != 0);
|
||||||
@ -100,7 +100,13 @@ int main() {
|
|||||||
a1.reset();
|
a1.reset();
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_array.hpp>
|
#include <boost/smart_ptr/make_unique_array.hpp>
|
||||||
|
|
||||||
@ -33,7 +34,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
try {
|
try {
|
||||||
boost::make_unique<type[]>(6);
|
boost::make_unique<type[]>(6);
|
||||||
@ -65,7 +65,13 @@ int main() {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_object.hpp>
|
#include <boost/smart_ptr/make_unique_object.hpp>
|
||||||
|
|
||||||
@ -29,7 +31,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<int> a1 = boost::make_unique_noinit<int>();
|
std::unique_ptr<int> a1 = boost::make_unique_noinit<int>();
|
||||||
BOOST_TEST(a1.get() != 0);
|
BOOST_TEST(a1.get() != 0);
|
||||||
@ -52,7 +53,13 @@ int main() {
|
|||||||
a1.reset();
|
a1.reset();
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_object.hpp>
|
#include <boost/smart_ptr/make_unique_object.hpp>
|
||||||
|
|
||||||
@ -29,7 +31,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<int> a1 = boost::make_unique<int>();
|
std::unique_ptr<int> a1 = boost::make_unique<int>();
|
||||||
BOOST_TEST(a1.get() != 0);
|
BOOST_TEST(a1.get() != 0);
|
||||||
@ -59,7 +60,13 @@ int main() {
|
|||||||
a1.reset();
|
a1.reset();
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_object.hpp>
|
#include <boost/smart_ptr/make_unique_object.hpp>
|
||||||
|
|
||||||
@ -32,7 +34,6 @@ private:
|
|||||||
unsigned int type::instances = 0;
|
unsigned int type::instances = 0;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
try {
|
try {
|
||||||
boost::make_unique<type>();
|
boost::make_unique<type>();
|
||||||
@ -40,7 +41,13 @@ int main() {
|
|||||||
} catch (...) {
|
} catch (...) {
|
||||||
BOOST_TEST(type::instances == 0);
|
BOOST_TEST(type::instances == 0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
* Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
* or copy at http://boost.org/LICENSE_1_0.txt)
|
* or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
#include <boost/smart_ptr/make_unique_object.hpp>
|
#include <boost/smart_ptr/make_unique_object.hpp>
|
||||||
|
|
||||||
@ -15,7 +17,6 @@ struct type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
#if !defined(BOOST_NO_CXX11_SMART_PTR)
|
|
||||||
{
|
{
|
||||||
std::unique_ptr<type> a1 = boost::make_unique<type>();
|
std::unique_ptr<type> a1 = boost::make_unique<type>();
|
||||||
BOOST_TEST(a1.get() != 0);
|
BOOST_TEST(a1.get() != 0);
|
||||||
@ -44,8 +45,14 @@ int main() {
|
|||||||
BOOST_TEST(a1->x == 1);
|
BOOST_TEST(a1->x == 1);
|
||||||
BOOST_TEST(a1->y == 2);
|
BOOST_TEST(a1->y == 2);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user