text
stringlengths
0
2.2M
#endif
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE
// This macro tests that the 'is_move_constructible' trait has the expected
// 'RESULT' for the given 'TYPE', and that all manifestations of that trait
// and value are consistent. First, test that the result of
// 'bsl::is_trivially_copyable<TYPE>' has the same value as the expected
// 'RESULT'. Then confirm that the expected result agrees with the native
// oracle, where available. Finally. confirm that the associated variable
// template, when available, has a value that agrees with this trait
// instantiation.
#define ASSERT_IS_TRIVIALLY_COPYABLE(TYPE, RESULT) \
ASSERT( bsl::is_trivially_copyable<TYPE>::value == RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CONSULT_ORACLE(TYPE); \
ASSERT_VARIABLE_TEMPLATE_IS_CONSISTENT(TYPE)
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE_LVAL_REF
// This macro tests that the 'is_trivially_copyable' trait has the expected
// 'RESULT' for an rvalue reference to the given 'TYPE' on platforms that
// implement language support, and performs no test otherwise. Note that the
// native trait implementation shipping with Visual C++ compilers prior to
// MSVC 2017 erroneously reports that rvalue-references to arrays are
// trivially copyable.
#if !defined(BSLMF_ISTRIVIALLYCOPYABLE_NATIVE_ORACLE_BAD_REFS)
# define ASSERT_IS_TRIVIALLY_COPYABLE_LVAL_REF(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE(bsl::add_lvalue_reference<TYPE>::type, false)
#else
# define ASSERT_IS_TRIVIALLY_COPYABLE_LVAL_REF(TYPE, RESULT)
#endif
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE_RVAL_REF
// This macro tests that the 'is_trivially_copyable' trait has the expected
// 'RESULT' for an rvalue reference to the given 'TYPE' on platforms that
// implement language support, and performs no test otherwise. Note that the
// native trait implementation shipping with Visual C++ compilers prior to
// MSVC 2017 erroneously reports that rvalue-references to arrays are
// trivially copyable.
#if defined(BSLS_COMPILERFEATURES_SUPPORT_RVALUE_REFERENCES) && \
!defined(BSLMF_ISTRIVIALLYCOPYABLE_NATIVE_ORACLE_BAD_REFS)
# define ASSERT_IS_TRIVIALLY_COPYABLE_RVAL_REF(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE(bsl::add_rvalue_reference<TYPE>::type, false)
#else
# define ASSERT_IS_TRIVIALLY_COPYABLE_RVAL_REF(TYPE, RESULT)
#endif
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE_TYPE
// This macro tests that the 'is_trivially_copyable' trait has the expected
// 'RESULT' for the given 'TYPE', and pointers/references to that type.
// Pointers are always trivially copyable, and references are never trivially
// copyable.
# define ASSERT_IS_TRIVIALLY_COPYABLE_TYPE(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE(TYPE, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE(bsl::add_pointer<TYPE>::type, true); \
ASSERT_IS_TRIVIALLY_COPYABLE_LVAL_REF(TYPE, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_RVAL_REF(TYPE, RESULT)
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE
// This macro tests that the 'is_trivially_copyable' trait has the expected
// 'RESULT' for the given 'TYPE', and all cv-qualified variations of that
// type, and pointers and references to each of those cv-qualified types.
#define ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE_TYPE(TYPE, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_TYPE(bsl::add_const<TYPE>::type, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_TYPE(bsl::add_volatile<TYPE>::type, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_TYPE(bsl::add_cv<TYPE>::type, RESULT)
// Macro: ASSERT_IS_TRIVIALLY_COPYABLE_OBJECT_TYPE
// This macro tests that the 'is_trivially_copyable' trait has the expected
// 'RESULT' for the given object 'TYPE', and all cv-qualified variations of
// that type, and pointers and references to each of those cv-qualified
// types, and arrays of those cv-qualified types. Note that this macro does
// not recursively test arrays of pointers to 'TYPE'.
#if defined(BSLS_PLATFORM_CMP_IBM)
// Last checked with the xlC 12.1 compiler. The IBM xlC compiler has problems
// correctly handling arrays of unknown bound as template parameters.
# define ASSERT_IS_TRIVIALLY_COPYABLE_OBJECT_TYPE(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[128], RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[12][8], RESULT)
#else
# define ASSERT_IS_TRIVIALLY_COPYABLE_OBJECT_TYPE(TYPE, RESULT) \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE, RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[128], RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[12][8], RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[], RESULT); \
ASSERT_IS_TRIVIALLY_COPYABLE_CV_TYPE(TYPE[][8], RESULT)
#endif
//=============================================================================
// GLOBAL TYPEDEFS/CONSTANTS FOR TESTING
//-----------------------------------------------------------------------------
namespace {
enum EnumTestType {
// This 'enum' type is used for testing.
};