Skip to content

Commit

Permalink
Add a test for uuid overalignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Jun 10, 2024
1 parent a6117a4 commit 1b4b53d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ boost_test(TYPE run SOURCES test_uuid_2.cpp)
boost_test(TYPE run SOURCES test_uuid_3.cpp)

boost_test(TYPE run SOURCES test_alignment.cpp)
boost_test(TYPE run SOURCES test_alignment_2.cpp)
boost_test(TYPE run SOURCES test_attribute_packed.cpp)
boost_test(TYPE run SOURCES test_pragma_pack.cpp)
boost_test(TYPE run SOURCES test_data.cpp)
Expand Down
1 change: 1 addition & 0 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ run test_uuid_3.cpp ;
# test type properties

run test_alignment.cpp ;
run test_alignment_2.cpp ;
run test_attribute_packed.cpp ;
run test_pragma_pack.cpp ;
run test_data.cpp ;
Expand Down
22 changes: 22 additions & 0 deletions test/test_alignment_2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/uuid/uuid.hpp>
#include <boost/core/lightweight_test.hpp>
#include <cstddef>

using namespace boost::uuids;

int main()
{
BOOST_TEST_LE( alignof(uuid), alignof(std::max_align_t) );

#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)

BOOST_TEST_LE( alignof(uuid), __STDCPP_DEFAULT_NEW_ALIGNMENT__ );

#endif

return boost::report_errors();
}

0 comments on commit 1b4b53d

Please sign in to comment.