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// <cmath>
15
16// Test the feature test macros defined by <cmath>
17
18/* Constant Value
19 __cpp_lib_constexpr_cmath 202202L [C++23]
20 __cpp_lib_hypot 201603L [C++17]
21 __cpp_lib_interpolate 201902L [C++20]
22 __cpp_lib_math_special_functions 201603L [C++17]
23*/
24
25#include <cmath>
26#include "test_macros.h"
27
28#if TEST_STD_VER < 14
29
30# ifdef __cpp_lib_constexpr_cmath
31# error "__cpp_lib_constexpr_cmath should not be defined before c++23"
32# endif
33
34# ifdef __cpp_lib_hypot
35# error "__cpp_lib_hypot should not be defined before c++17"
36# endif
37
38# ifdef __cpp_lib_interpolate
39# error "__cpp_lib_interpolate should not be defined before c++20"
40# endif
41
42# ifdef __cpp_lib_math_special_functions
43# error "__cpp_lib_math_special_functions should not be defined before c++17"
44# endif
45
46#elif TEST_STD_VER == 14
47
48# ifdef __cpp_lib_constexpr_cmath
49# error "__cpp_lib_constexpr_cmath should not be defined before c++23"
50# endif
51
52# ifdef __cpp_lib_hypot
53# error "__cpp_lib_hypot should not be defined before c++17"
54# endif
55
56# ifdef __cpp_lib_interpolate
57# error "__cpp_lib_interpolate should not be defined before c++20"
58# endif
59
60# ifdef __cpp_lib_math_special_functions
61# error "__cpp_lib_math_special_functions should not be defined before c++17"
62# endif
63
64#elif TEST_STD_VER == 17
65
66# ifdef __cpp_lib_constexpr_cmath
67# error "__cpp_lib_constexpr_cmath should not be defined before c++23"
68# endif
69
70# ifndef __cpp_lib_hypot
71# error "__cpp_lib_hypot should be defined in c++17"
72# endif
73# if __cpp_lib_hypot != 201603L
74# error "__cpp_lib_hypot should have the value 201603L in c++17"
75# endif
76
77# ifdef __cpp_lib_interpolate
78# error "__cpp_lib_interpolate should not be defined before c++20"
79# endif
80
81# if !defined(_LIBCPP_VERSION)
82# ifndef __cpp_lib_math_special_functions
83# error "__cpp_lib_math_special_functions should be defined in c++17"
84# endif
85# if __cpp_lib_math_special_functions != 201603L
86# error "__cpp_lib_math_special_functions should have the value 201603L in c++17"
87# endif
88# else // _LIBCPP_VERSION
89# ifdef __cpp_lib_math_special_functions
90# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
91# endif
92# endif
93
94#elif TEST_STD_VER == 20
95
96# ifdef __cpp_lib_constexpr_cmath
97# error "__cpp_lib_constexpr_cmath should not be defined before c++23"
98# endif
99
100# ifndef __cpp_lib_hypot
101# error "__cpp_lib_hypot should be defined in c++20"
102# endif
103# if __cpp_lib_hypot != 201603L
104# error "__cpp_lib_hypot should have the value 201603L in c++20"
105# endif
106
107# ifndef __cpp_lib_interpolate
108# error "__cpp_lib_interpolate should be defined in c++20"
109# endif
110# if __cpp_lib_interpolate != 201902L
111# error "__cpp_lib_interpolate should have the value 201902L in c++20"
112# endif
113
114# if !defined(_LIBCPP_VERSION)
115# ifndef __cpp_lib_math_special_functions
116# error "__cpp_lib_math_special_functions should be defined in c++20"
117# endif
118# if __cpp_lib_math_special_functions != 201603L
119# error "__cpp_lib_math_special_functions should have the value 201603L in c++20"
120# endif
121# else // _LIBCPP_VERSION
122# ifdef __cpp_lib_math_special_functions
123# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
124# endif
125# endif
126
127#elif TEST_STD_VER == 23
128
129# if !defined(_LIBCPP_VERSION)
130# ifndef __cpp_lib_constexpr_cmath
131# error "__cpp_lib_constexpr_cmath should be defined in c++23"
132# endif
133# if __cpp_lib_constexpr_cmath != 202202L
134# error "__cpp_lib_constexpr_cmath should have the value 202202L in c++23"
135# endif
136# else // _LIBCPP_VERSION
137# ifdef __cpp_lib_constexpr_cmath
138# error "__cpp_lib_constexpr_cmath should not be defined because it is unimplemented in libc++!"
139# endif
140# endif
141
142# ifndef __cpp_lib_hypot
143# error "__cpp_lib_hypot should be defined in c++23"
144# endif
145# if __cpp_lib_hypot != 201603L
146# error "__cpp_lib_hypot should have the value 201603L in c++23"
147# endif
148
149# ifndef __cpp_lib_interpolate
150# error "__cpp_lib_interpolate should be defined in c++23"
151# endif
152# if __cpp_lib_interpolate != 201902L
153# error "__cpp_lib_interpolate should have the value 201902L in c++23"
154# endif
155
156# if !defined(_LIBCPP_VERSION)
157# ifndef __cpp_lib_math_special_functions
158# error "__cpp_lib_math_special_functions should be defined in c++23"
159# endif
160# if __cpp_lib_math_special_functions != 201603L
161# error "__cpp_lib_math_special_functions should have the value 201603L in c++23"
162# endif
163# else // _LIBCPP_VERSION
164# ifdef __cpp_lib_math_special_functions
165# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
166# endif
167# endif
168
169#elif TEST_STD_VER > 23
170
171# if !defined(_LIBCPP_VERSION)
172# ifndef __cpp_lib_constexpr_cmath
173# error "__cpp_lib_constexpr_cmath should be defined in c++26"
174# endif
175# if __cpp_lib_constexpr_cmath != 202202L
176# error "__cpp_lib_constexpr_cmath should have the value 202202L in c++26"
177# endif
178# else // _LIBCPP_VERSION
179# ifdef __cpp_lib_constexpr_cmath
180# error "__cpp_lib_constexpr_cmath should not be defined because it is unimplemented in libc++!"
181# endif
182# endif
183
184# ifndef __cpp_lib_hypot
185# error "__cpp_lib_hypot should be defined in c++26"
186# endif
187# if __cpp_lib_hypot != 201603L
188# error "__cpp_lib_hypot should have the value 201603L in c++26"
189# endif
190
191# ifndef __cpp_lib_interpolate
192# error "__cpp_lib_interpolate should be defined in c++26"
193# endif
194# if __cpp_lib_interpolate != 201902L
195# error "__cpp_lib_interpolate should have the value 201902L in c++26"
196# endif
197
198# if !defined(_LIBCPP_VERSION)
199# ifndef __cpp_lib_math_special_functions
200# error "__cpp_lib_math_special_functions should be defined in c++26"
201# endif
202# if __cpp_lib_math_special_functions != 201603L
203# error "__cpp_lib_math_special_functions should have the value 201603L in c++26"
204# endif
205# else // _LIBCPP_VERSION
206# ifdef __cpp_lib_math_special_functions
207# error "__cpp_lib_math_special_functions should not be defined because it is unimplemented in libc++!"
208# endif
209# endif
210
211#endif // TEST_STD_VER > 23
212
213

source code of libcxx/test/std/language.support/support.limits/support.limits.general/cmath.version.compile.pass.cpp