mirror of
https://github.com/boostorg/core.git
synced 2025-11-29 05:40:14 +01:00
Add boost::core::max_align(_t)
This commit is contained in:
53
test/max_align_test.cpp
Normal file
53
test/max_align_test.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright 2023 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/max_align.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
struct X
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( boost::core::max_align, boost::alignment_of<boost::core::max_align_t>::value );
|
||||
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<char>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<short>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<int>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<long>::value );
|
||||
|
||||
#ifndef BOOST_NO_LONG_LONG
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<boost::long_long_type>::value );
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_INT128
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<boost::int128_type>::value );
|
||||
#endif
|
||||
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<float>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<double>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<long double>::value );
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<__float128>::value );
|
||||
#endif
|
||||
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<void*>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<void(*)()>::value );
|
||||
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<int X::*>::value );
|
||||
BOOST_TEST_GE( boost::core::max_align, boost::alignment_of<void (X::*)()>::value );
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_ALIGNOF)
|
||||
|
||||
BOOST_TEST_EQ( boost::core::max_align, alignof( std::max_align_t ) );
|
||||
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
Reference in New Issue
Block a user