2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00
Files
pfr/test/core/Jamfile.v2
2024-08-24 12:34:29 +03:00

141 lines
5.1 KiB
Plaintext

# Copyright (C) 2016-2024 Antony Polukhin.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
import-search /boost/config/checks ;
import python ;
import testing ;
import config : requires ;
project
: source-location .
: requirements
<library>/boost/config//boost_config
<library>/boost/core//boost_core
<library>/boost/container_hash//boost_container_hash
<library>/boost/type_index//boost_type_index
<define>BOOST_PFR_DETAIL_STRICT_RVALUE_TESTING=1
[ requires cxx14_constexpr ]
;
########## BEGIN of helpers to detect Loophole trick support
actions mp_simple_run_action
{
$(>) > $(<)
}
rule mp-run-simple ( sources + : args * : input-files * : requirements * : target-name )
{
exe $(target-name)_exe : $(sources) : $(requirements) ;
explicit $(target-name)_exe ;
make $(target-name).output : $(target-name)_exe : @mp_simple_run_action ;
explicit $(target-name).output ;
alias $(target-name) : $(target-name).output ;
}
mp-run-simple loophole_detection.cpp : : : : compiler_supports_loophole ;
explicit compiler_supports_loophole ;
########## END of helpers to detect Loophole trick support
local DISABLE_ON_MSVC = ; #<toolset>msvc:<build>no ;
local REQUIRE_LOOPHOLE =
[ check-target-builds ../core//compiler_supports_loophole : : <build>no ]
;
local STRUCTURED_BINDING_ENGINE = <define>BOOST_PFR_USE_LOOPHOLE=0 <define>BOOST_PFR_USE_CPP17=1 [ requires cxx17_structured_bindings ] ;
local LOOPHOLE_ENGINE = <define>BOOST_PFR_USE_LOOPHOLE=1 <define>BOOST_PFR_USE_CPP17=0 $(REQUIRE_LOOPHOLE) ;
local CLASSIC_ENGINE = <define>BOOST_PFR_USE_LOOPHOLE=0 <define>BOOST_PFR_USE_CPP17=0 $(DISABLE_ON_MSVC) ;
test-suite pfr_tests
:
[ run offset_based_getter.cpp ]
[ run can_be_as_fallback_in_the_fusion.cpp ]
[ run test_tuple_sizes_on.cpp : : : <define>BOOST_PFR_RUN_TEST_ON=char : test_tuple_sizes_on_chars ]
[ run test_tuple_sizes_on.cpp : : : <define>BOOST_PFR_RUN_TEST_ON=int : test_tuple_sizes_on_ints ]
[ run test_tuple_sizes_on.cpp : : : <define>BOOST_PFR_RUN_TEST_ON=short : test_tuple_sizes_on_shorts ]
[ run test_tuple_sizes_on.cpp : : : <define>BOOST_PFR_RUN_TEST_ON=void* : test_tuple_sizes_on_voidptrs ]
[ run test_tuple_sizes_on.cpp : : : <define>BOOST_PFR_RUN_TEST_ON="std::size_t" : test_tuple_sizes_on_size_ts ]
[ run run/motivating_example.cpp : : : : auto_engine_motivating ]
[ run ../../example/sample_printing.cpp : : : : auto_engine_sample_printing ]
[ run ../../example/get.cpp : : : : auto_engine_get ]
[ run ../../example/quick_examples.cpp : : : : auto_engine_quick ]
;
local BLACKLIST_TESTS_FOR_LOOPHOLE =
constexpr_ops # Loophole is not constexpr usable because of the reinterpret_cast usage
get_const_field # boost::pfr::get gives compile time error on const fields
optional_chrono # boost::pfr::* has problems with std::optional, produces compile time error
template_constructor # Template constructor in one of the fields of the aggregate
tie_anonymous_const_field # boost::pfr::structure_tie gives compile time error on const fields
;
# Those tests are either
# * reflecting a non literal type
# * or calling boost::pfr::get and the result is a user defined structure
local BLACKLIST_TESTS_FOR_CLASSIC =
constexpr_ops
get_const_field
get_non_default_constructible
get_rvalue
issue30
issue33
motivating_example0
motivating_example2
optional_chrono
optional_like
read_write_non_literal
template_constructor
template_forwarding_ref
template_unconstrained
tie_anonymous
tie_anonymous_const_field
;
for local source_file in [ glob ./run/*.cpp ] [ glob ../../example/*.cpp ]
{
local target_name = $(source_file[1]:B) ;
pfr_tests += [ run $(source_file) : : : $(STRUCTURED_BINDING_ENGINE) : $(target_name)_sb ] ;
if ! $(target_name) in $(BLACKLIST_TESTS_FOR_LOOPHOLE)
{
pfr_tests += [ run $(source_file) : : : $(LOOPHOLE_ENGINE) : $(target_name)_lh ] ;
}
else
{
pfr_tests += [ compile-fail $(source_file) : $(LOOPHOLE_ENGINE) : $(target_name)_lh ] ;
}
if ! $(target_name) in $(BLACKLIST_TESTS_FOR_CLASSIC)
{
pfr_tests += [ run $(source_file) : : : $(CLASSIC_ENGINE) : $(target_name)_classic ] ;
}
else
{
pfr_tests += [ compile-fail $(source_file) : $(CLASSIC_ENGINE) : $(target_name)_classic ] ;
}
}
for local source_file in [ glob ./compile-fail/*.cpp ]
{
local target_name = $(source_file[1]:B) ;
pfr_tests += [ compile-fail $(source_file) : $(STRUCTURED_BINDING_ENGINE) : $(target_name)_sb ] ;
pfr_tests += [ compile-fail $(source_file) : $(LOOPHOLE_ENGINE) : $(target_name)_lh ] ;
pfr_tests += [ compile-fail $(source_file) : $(CLASSIC_ENGINE) : $(target_name)_classic ] ;
}
if [ python.configured ]
{
testing.make-test run-pyd : ../../misc/generate_cpp17.py ;
}