| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
// |
| 9 |
// WARNING: This test was generated by generate_feature_test_macro_components.py |
| 10 |
// and should not be edited manually. |
| 11 |
// |
| 12 |
// clang-format off |
| 13 |
|
| 14 |
// <random> |
| 15 |
|
| 16 |
// Test the feature test macros defined by <random> |
| 17 |
|
| 18 |
/* Constant Value |
| 19 |
__cpp_lib_generate_random 202403L [C++26] |
| 20 |
__cpp_lib_philox_engine 202406L [C++26] |
| 21 |
*/ |
| 22 |
|
| 23 |
#include <random> |
| 24 |
#include "test_macros.h" |
| 25 |
|
| 26 |
#if TEST_STD_VER < 14 |
| 27 |
|
| 28 |
# ifdef __cpp_lib_generate_random |
| 29 |
# error "__cpp_lib_generate_random should not be defined before c++26" |
| 30 |
# endif |
| 31 |
|
| 32 |
# ifdef __cpp_lib_philox_engine |
| 33 |
# error "__cpp_lib_philox_engine should not be defined before c++26" |
| 34 |
# endif |
| 35 |
|
| 36 |
#elif TEST_STD_VER == 14 |
| 37 |
|
| 38 |
# ifdef __cpp_lib_generate_random |
| 39 |
# error "__cpp_lib_generate_random should not be defined before c++26" |
| 40 |
# endif |
| 41 |
|
| 42 |
# ifdef __cpp_lib_philox_engine |
| 43 |
# error "__cpp_lib_philox_engine should not be defined before c++26" |
| 44 |
# endif |
| 45 |
|
| 46 |
#elif TEST_STD_VER == 17 |
| 47 |
|
| 48 |
# ifdef __cpp_lib_generate_random |
| 49 |
# error "__cpp_lib_generate_random should not be defined before c++26" |
| 50 |
# endif |
| 51 |
|
| 52 |
# ifdef __cpp_lib_philox_engine |
| 53 |
# error "__cpp_lib_philox_engine should not be defined before c++26" |
| 54 |
# endif |
| 55 |
|
| 56 |
#elif TEST_STD_VER == 20 |
| 57 |
|
| 58 |
# ifdef __cpp_lib_generate_random |
| 59 |
# error "__cpp_lib_generate_random should not be defined before c++26" |
| 60 |
# endif |
| 61 |
|
| 62 |
# ifdef __cpp_lib_philox_engine |
| 63 |
# error "__cpp_lib_philox_engine should not be defined before c++26" |
| 64 |
# endif |
| 65 |
|
| 66 |
#elif TEST_STD_VER == 23 |
| 67 |
|
| 68 |
# ifdef __cpp_lib_generate_random |
| 69 |
# error "__cpp_lib_generate_random should not be defined before c++26" |
| 70 |
# endif |
| 71 |
|
| 72 |
# ifdef __cpp_lib_philox_engine |
| 73 |
# error "__cpp_lib_philox_engine should not be defined before c++26" |
| 74 |
# endif |
| 75 |
|
| 76 |
#elif TEST_STD_VER > 23 |
| 77 |
|
| 78 |
# if !defined(_LIBCPP_VERSION) |
| 79 |
# ifndef __cpp_lib_generate_random |
| 80 |
# error "__cpp_lib_generate_random should be defined in c++26" |
| 81 |
# endif |
| 82 |
# if __cpp_lib_generate_random != 202403L |
| 83 |
# error "__cpp_lib_generate_random should have the value 202403L in c++26" |
| 84 |
# endif |
| 85 |
# else // _LIBCPP_VERSION |
| 86 |
# ifdef __cpp_lib_generate_random |
| 87 |
# error "__cpp_lib_generate_random should not be defined because it is unimplemented in libc++!" |
| 88 |
# endif |
| 89 |
# endif |
| 90 |
|
| 91 |
# if !defined(_LIBCPP_VERSION) |
| 92 |
# ifndef __cpp_lib_philox_engine |
| 93 |
# error "__cpp_lib_philox_engine should be defined in c++26" |
| 94 |
# endif |
| 95 |
# if __cpp_lib_philox_engine != 202406L |
| 96 |
# error "__cpp_lib_philox_engine should have the value 202406L in c++26" |
| 97 |
# endif |
| 98 |
# else // _LIBCPP_VERSION |
| 99 |
# ifdef __cpp_lib_philox_engine |
| 100 |
# error "__cpp_lib_philox_engine should not be defined because it is unimplemented in libc++!" |
| 101 |
# endif |
| 102 |
# endif |
| 103 |
|
| 104 |
#endif // TEST_STD_VER > 23 |
| 105 |
|