mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Added value_init test for C style array of bytes
[SVN r41647]
This commit is contained in:
parent
882d38c2c7
commit
7300ac83f1
@ -152,6 +152,8 @@ struct AggregatePODStructWrapper
|
|||||||
bool operator == ( AggregatePODStructWrapper const& lhs, AggregatePODStructWrapper const& rhs )
|
bool operator == ( AggregatePODStructWrapper const& lhs, AggregatePODStructWrapper const& rhs )
|
||||||
{ return lhs.dataMember == rhs.dataMember ; }
|
{ return lhs.dataMember == rhs.dataMember ; }
|
||||||
|
|
||||||
|
typedef unsigned char ArrayOfBytes[256];
|
||||||
|
|
||||||
//
|
//
|
||||||
// This test function tests boost::value_initialized<T> for a specific type T.
|
// This test function tests boost::value_initialized<T> for a specific type T.
|
||||||
// The first argument (y) is assumed have the value of a value-initialized object.
|
// The first argument (y) is assumed have the value of a value-initialized object.
|
||||||
@ -232,6 +234,10 @@ int test_main(int, char **)
|
|||||||
aggregatePODStructWrapper1.dataMember = nonZeroInitializedAggregatePODStruct;
|
aggregatePODStructWrapper1.dataMember = nonZeroInitializedAggregatePODStruct;
|
||||||
BOOST_CHECK ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) );
|
BOOST_CHECK ( test(aggregatePODStructWrapper0, aggregatePODStructWrapper1) );
|
||||||
|
|
||||||
|
ArrayOfBytes zeroInitializedArrayOfBytes = { 0 };
|
||||||
|
boost::value_initialized<ArrayOfBytes> valueInitializedArrayOfBytes;
|
||||||
|
BOOST_CHECK (std::memcmp(get(valueInitializedArrayOfBytes), zeroInitializedArrayOfBytes, sizeof(ArrayOfBytes)) == 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user