Skip to content

Commit 010c785

Browse files
committed
Split variant_index_type into separate runs for each variant size
1 parent d77d61c commit 010c785

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

test/Jamfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,16 @@ compile variant_visit_cx.cpp : [ requires cxx14_constexpr ] ;
144144
compile variant_visit_cx_2.cpp : [ requires cxx14_constexpr ] ;
145145
compile variant_visit_r_cx.cpp : [ requires cxx14_constexpr ] ;
146146

147-
run variant_index_type.cpp : : :
147+
local index-type-reqs =
148+
148149
<variant>release
149150
<toolset>msvc,<address-model>32:<build>no
150-
<toolset>msvc-14.0:<build>no # fails on GHA (only) with "out of heap space"
151151
<toolset>clang,<target-os>linux:<cxxflags>-ftemplate-depth=1024 # for Clang 3.x
152152
;
153+
154+
local list-sizes = 126 127 128 129 254 255 256 257 ;
155+
156+
for local list-size in $(list-sizes)
157+
{
158+
run variant_index_type.cpp : : : $(index-type-reqs) <define>LIST_SIZE=$(list-size) : variant_index_type_$(list-size) ;
159+
}

test/variant_index_type.cpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ template<std::size_t I> struct W
4343

4444
template<class N> using Wf = W< N::value >;
4545

46-
template<template<class...> class F, std::size_t N> void test_()
46+
template<class L, template<class...> class F> void test()
4747
{
48-
using V = mp_rename< mp_transform<F, mp_iota_c<N>>, boost::variant2::variant >;
48+
using V = mp_rename< mp_transform<F, L>, boost::variant2::variant >;
49+
50+
constexpr std::size_t N = mp_size<L>::value;
4951

5052
using last_type = F<mp_size_t<N-1>>;
5153

@@ -63,32 +65,22 @@ template<template<class...> class F, std::size_t N> void test_()
6365
}
6466
}
6567

66-
template<template<class...> class F> void test()
67-
{
68-
test_<F, 126>();
69-
test_<F, 127>();
70-
test_<F, 128>();
71-
test_<F, 129>();
72-
73-
test_<F, 254>();
74-
test_<F, 255>();
75-
test_<F, 256>();
76-
test_<F, 257>();
77-
}
78-
7968
int main()
8069
{
70+
constexpr std::size_t N = LIST_SIZE;
71+
using L = mp_iota_c<N>;
72+
8173
static_assert( !boost::variant2::variant< X<0>, X<1> >::uses_double_storage(), "" );
82-
test<Xf>();
74+
test<L, Xf>();
8375

8476
static_assert( boost::variant2::variant< Y<0>, Y<1> >::uses_double_storage(), "" );
85-
test<Yf>();
77+
test<L, Yf>();
8678

8779
static_assert( !boost::variant2::variant< Z<0>, Z<1> >::uses_double_storage(), "" );
88-
test<Zf>();
80+
test<L, Zf>();
8981

9082
static_assert( boost::variant2::variant< W<0>, W<1> >::uses_double_storage(), "" );
91-
test<Wf>();
83+
test<L, Wf>();
9284

9385
return boost::report_errors();
9486
}

0 commit comments

Comments
 (0)