Skip to content

Commit dd3be65

Browse files
committed
Add tests for dynamic allocated cpp_int
1 parent 5c66991 commit dd3be65

7 files changed

Lines changed: 569 additions & 0 deletions

config/Jamfile.v2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ exe has_eigen : has_eigen.cpp ;
7777
exe has_f2c : has_f2c.cpp f2c ;
7878
obj has_is_constant_evaluated : has_is_constant_evaluated.cpp ;
7979
obj has_constexpr_limits : has_constexpr_limits_cmd.cpp : <cxxflags>-fconstexpr-ops-limit=268435456 ;
80+
obj has_constexpr_dynamic_memory : has_constexpr_dynamic_memory.cpp : <cxxflags>-std=c++2a ;
8081
obj has_big_obj : has_big_obj.cpp : <cxxflags>-Wa,-mbig-obj ;
8182
obj is_ci_sanitizer_run : is_ci_sanitizer_run.cpp ;
8283

@@ -91,6 +92,7 @@ explicit has_mpc ;
9192
explicit has_eigen ;
9293
explicit has_is_constant_evaluated ;
9394
explicit has_constexpr_limits ;
95+
explicit has_constexpr_dynamic_memory ;
9496
explicit has_big_obj ;
9597
explicit has_f2c ;
9698
explicit is_ci_sanitizer_run ;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright John Maddock 2025.
2+
// Use, modification and distribution are subject to the
3+
// Boost Software License, Version 1.0. (See accompanying file
4+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include <memory>
7+
8+
9+
#if !defined(__cpp_constexpr_dynamic_alloc)
10+
# error "__cpp_constexpr_dynamic_alloc is not defined"
11+
12+
#elif __cpp_constexpr_dynamic_alloc < 201907
13+
# error "__cpp_constexpr_dynamic_alloc is defined with value < 201907"
14+
15+
#elif !defined(__cpp_lib_constexpr_dynamic_alloc)
16+
# error "__cpp_lib_constexpr_dynamic_alloc is not defined"
17+
18+
#elif __cpp_lib_constexpr_dynamic_alloc < 201907
19+
# error "__cpp_lib_constexpr_dynamic_alloc is defined with value < 201907"
20+
#endif
21+
22+
int main()
23+
{
24+
return 0;
25+
}

test/Jamfile.v2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,8 @@ test-suite misc :
10621062
[ run constexpr_test_cpp_int_5.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : : <build>no ] ]
10631063
[ run constexpr_test_cpp_int_6.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : "<toolset>msvc:<cxxflags>-constexpr:steps10000000" <toolset>clang:<cxxflags>-fconstexpr-steps=268435456 : <build>no ] [ check-target-builds ../config//has_constexpr_limits : <cxxflags>-fconstexpr-ops-limit=268435456 ] ]
10641064
[ run constexpr_test_cpp_int_7.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : "<toolset>msvc:<cxxflags>-constexpr:steps10000000" <toolset>clang:<cxxflags>-fconstexpr-steps=268435456 : <build>no ] ]
1065+
[ run constexpr_test_dynamic_cpp_int_1.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_constexpr_dynamic_memory : <toolset>msvc:<cxxflags>-constexpr\:steps10000000 <toolset>clang:<cxxflags>-fconstexpr-steps=268435456 <cxxflags>-std=c++2a : <build>no ] ]
1066+
[ run constexpr_test_dynamic_cpp_int_2.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_constexpr_dynamic_memory : <toolset>msvc:<cxxflags>-constexpr\:steps10000000 <toolset>clang:<cxxflags>-fconstexpr-steps=268435456 <cxxflags>-std=c++2a : <build>no ] ]
10651067

10661068
[ compile test_nothrow_cpp_int.cpp ]
10671069
[ compile test_nothrow_cpp_rational.cpp ]
@@ -1334,6 +1336,7 @@ test-suite standalone :
13341336
[ run standalone_constexpr_test_cpp_int.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_is_constant_evaluated : : <build>no ] ]
13351337
[ compile standalone_constexpr_test_float128.cpp :
13361338
[ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_float128 : <source>quadmath : <build>no ] ]
1339+
[ run standalone_constexpr_test_dynamic_cpp_int.cpp : : : [ requires cxx14_constexpr cxx17_if_constexpr ] [ check-target-builds ../config//has_constexpr_dynamic_memory : <toolset>msvc:<cxxflags>-constexpr\:steps10000000 <toolset>clang:<cxxflags>-fconstexpr-steps=268435456 <cxxflags>-std=c++2a : <build>no ] ]
13371340

13381341
[ run standalone_test_arithmetic_complex128.cpp : : : [ check-target-builds ../config//has_float128 : <source>quadmath ] ]
13391342
[ run standalone_test_arithmetic_cpp_bin_float.cpp no_eh_support : : : <toolset>msvc:<cxxflags>/bigobj [ check-target-builds ../config//has_float128 : <source>quadmath ] ]

0 commit comments

Comments
 (0)