stlab.adobe.com Adobe Systems Incorporated

check_regular.hpp

Go to the documentation of this file.
00001 /*
00002     Copyright 2005-2007 Adobe Systems Incorporated
00003     Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004     or a copy at http://stlab.adobe.com/licenses.html)
00005 */
00006 
00007 /*************************************************************************************************/
00008 
00009 #include <adobe/config.hpp>
00010 #include <boost/test/test_case_template.hpp>
00011 #include <adobe/implementation/swap.hpp>
00012 
00013 namespace adobe {
00019 template <typename T>
00020 T arbitrary_regular_value();
00021 
00022 
00023 template <typename T>
00024 void check_regular(const T& x)
00025 {
00026     using std::swap;
00027 
00028     BOOST_CHECK(x != T());
00029     T y = x;
00030     BOOST_CHECK_MESSAGE(x == y, "copy-ctor");
00031     T z = T();
00032     BOOST_CHECK_MESSAGE(z != x, "default-ctor");
00033     z = y;
00034     BOOST_CHECK_MESSAGE(x == z, "assignment");
00035     T w = T();
00036     swap(y, w);
00037     BOOST_CHECK(x == w && x != y && y == T());
00038 }
00039 
00040 
00041 BOOST_TEST_CASE_TEMPLATE_FUNCTION(check_regulars, T)
00042 {
00043     check_regular(arbitrary_regular_value<T>());
00044 }
00045 
00046 }
00047 

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google