|
5 | 5 | #include "pybind11_tests.h"
|
6 | 6 |
|
7 | 7 | // IUT = Implementation Under Test
|
8 |
| -# define CONST_NAME_TESTS(TEST_FUNC, IUT) \ |
9 |
| - std::string TEST_FUNC(int selector) { \ |
10 |
| - switch (selector) { \ |
11 |
| - case 0: \ |
12 |
| - return IUT("").text; \ |
13 |
| - case 1: \ |
14 |
| - return IUT("A").text; \ |
15 |
| - case 2: \ |
16 |
| - return IUT("Bd").text; \ |
17 |
| - case 3: \ |
18 |
| - return IUT("Cef").text; \ |
19 |
| - case 4: \ |
20 |
| - return IUT<int>().text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
21 |
| - case 5: \ |
22 |
| - return IUT<std::string>().text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
23 |
| - case 6: \ |
24 |
| - return IUT<true>("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
25 |
| - case 7: \ |
26 |
| - return IUT<false>("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
27 |
| - case 8: \ |
28 |
| - /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ |
29 |
| - return IUT<true>(IUT("D1"), IUT("D2")).text; \ |
30 |
| - case 9: \ |
31 |
| - /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ |
32 |
| - return IUT<false>(IUT("E1"), IUT("E2")).text; \ |
33 |
| - case 10: \ |
34 |
| - return IUT("KeepAtEnd").text; \ |
35 |
| - default: \ |
36 |
| - break; \ |
37 |
| - } \ |
38 |
| - throw std::runtime_error("Invalid selector value."); \ |
39 |
| - } |
| 8 | +#define CONST_NAME_TESTS(TEST_FUNC, IUT) \ |
| 9 | + std::string TEST_FUNC(int selector) { \ |
| 10 | + switch (selector) { \ |
| 11 | + case 0: \ |
| 12 | + return IUT("").text; \ |
| 13 | + case 1: \ |
| 14 | + return IUT("A").text; \ |
| 15 | + case 2: \ |
| 16 | + return IUT("Bd").text; \ |
| 17 | + case 3: \ |
| 18 | + return IUT("Cef").text; \ |
| 19 | + case 4: \ |
| 20 | + return IUT<int>().text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
| 21 | + case 5: \ |
| 22 | + return IUT<std::string>().text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
| 23 | + case 6: \ |
| 24 | + return IUT<true>("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
| 25 | + case 7: \ |
| 26 | + return IUT<false>("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \ |
| 27 | + case 8: \ |
| 28 | + /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ |
| 29 | + return IUT<true>(IUT("D1"), IUT("D2")).text; \ |
| 30 | + case 9: \ |
| 31 | + /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \ |
| 32 | + return IUT<false>(IUT("E1"), IUT("E2")).text; \ |
| 33 | + case 10: \ |
| 34 | + return IUT("KeepAtEnd").text; \ |
| 35 | + default: \ |
| 36 | + break; \ |
| 37 | + } \ |
| 38 | + throw std::runtime_error("Invalid selector value."); \ |
| 39 | + } |
40 | 40 |
|
41 | 41 | CONST_NAME_TESTS(const_name_tests, py::detail::const_name)
|
42 | 42 |
|
43 |
| -# ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY |
| 43 | +#ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY |
44 | 44 | CONST_NAME_TESTS(underscore_tests, py::detail::_)
|
45 |
| -# endif |
| 45 | +#endif |
46 | 46 |
|
47 | 47 | TEST_SUBMODULE(const_name, m) {
|
48 | 48 | m.def("const_name_tests", const_name_tests);
|
|
0 commit comments