@@ -96,9 +96,7 @@ TEST_CONSTEXPR_CXX26 void test_larger_sorts() {
9696 std::stable_sort (array, array + N);
9797 assert (std::is_sorted (array, array + N));
9898 // test random pattern
99- #if TEST_STD_VER >= 26
100- if !consteval // random-number generators not constexpr-friendly
101- #endif
99+ if (!TEST_IS_CONSTANT_EVALUATED) // random-number generators not constexpr-friendly
102100 {
103101 static std::mt19937 randomness;
104102 std::shuffle (array, array + N, randomness);
@@ -142,10 +140,7 @@ TEST_CONSTEXPR_CXX26 void test() {
142140 std::stable_sort (&d, &d);
143141
144142 // exhaustively test all possibilities up to length 8
145- #if TEST_STD_VER >= 26
146- if !consteval
147- #endif
148- {
143+ if (!TEST_IS_CONSTANT_EVALUATED) {
149144 test_sort_<1 >();
150145 test_sort_<2 >();
151146 test_sort_<3 >();
@@ -158,9 +153,7 @@ TEST_CONSTEXPR_CXX26 void test() {
158153
159154 test_larger_sorts<256 >();
160155 test_larger_sorts<257 >();
161- #if TEST_STD_VER >= 26
162- if !consteval // only runtime tests bc. error: "constexpr evaluation hit maximum step limit"
163- #endif
156+ if (!TEST_IS_CONSTANT_EVALUATED) // only runtime tests bc. error: "constexpr evaluation hit maximum step limit"
164157 {
165158 test_larger_sorts<499 >();
166159 test_larger_sorts<500 >();
@@ -169,16 +162,14 @@ TEST_CONSTEXPR_CXX26 void test() {
169162 test_larger_sorts<1009 >();
170163 }
171164
172- #if !defined(TEST_HAS_NO_EXCEPTIONS)
173- # if TEST_STD_VER >= 26
174- if !consteval
175- # endif
176- { // check that the algorithm works without memory
165+ // check that the algorithm works without memory
166+ #ifndef TEST_HAS_NO_EXCEPTIONS
167+ if (!TEST_IS_CONSTANT_EVALUATED) {
177168 std::vector<int > vec (150 , 3 );
178169 getGlobalMemCounter ()->throw_after = 0 ;
179170 std::stable_sort (vec.begin (), vec.end ());
180171 }
181- #endif // !defined(TEST_HAS_NO_EXCEPTIONS)
172+ #endif
182173}
183174
184175int main (int , char **) {
0 commit comments