aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tests/test_const_name.cpp
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-09-14 09:28:47 +0200
committergatecat <gatecat@ds0.me>2022-09-14 09:28:47 +0200
commita72f898ff4c4237424c468044a6db9d6953b541e (patch)
tree1c4a543f661dd1b281aecf4660388491702fa8d8 /3rdparty/pybind11/tests/test_const_name.cpp
parentf1349e114f3a16ccd002e8513339e18f5be4d31b (diff)
downloadnextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.tar.gz
nextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.tar.bz2
nextpnr-a72f898ff4c4237424c468044a6db9d6953b541e.zip
3rdparty: Bump vendored pybind11 version for py3.11 support
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to '3rdparty/pybind11/tests/test_const_name.cpp')
-rw-r--r--3rdparty/pybind11/tests/test_const_name.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/3rdparty/pybind11/tests/test_const_name.cpp b/3rdparty/pybind11/tests/test_const_name.cpp
new file mode 100644
index 00000000..2ad01e68
--- /dev/null
+++ b/3rdparty/pybind11/tests/test_const_name.cpp
@@ -0,0 +1,55 @@
+// Copyright (c) 2021 The Pybind Development Team.
+// All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "pybind11_tests.h"
+
+// IUT = Implementation Under Test
+#define CONST_NAME_TESTS(TEST_FUNC, IUT) \
+ std::string TEST_FUNC(int selector) { \
+ switch (selector) { \
+ case 0: \
+ return IUT("").text; \
+ case 1: \
+ return IUT("A").text; \
+ case 2: \
+ return IUT("Bd").text; \
+ case 3: \
+ return IUT("Cef").text; \
+ case 4: \
+ return IUT<int>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
+ case 5: \
+ return IUT<std::string>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
+ case 6: \
+ return IUT<true>("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
+ case 7: \
+ return IUT<false>("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
+ case 8: \
+ /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
+ return IUT<true>(IUT("D1"), IUT("D2")).text; \
+ case 9: \
+ /*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
+ return IUT<false>(IUT("E1"), IUT("E2")).text; \
+ case 10: \
+ return IUT("KeepAtEnd").text; \
+ default: \
+ break; \
+ } \
+ throw std::runtime_error("Invalid selector value."); \
+ }
+
+CONST_NAME_TESTS(const_name_tests, py::detail::const_name)
+
+#ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY
+CONST_NAME_TESTS(underscore_tests, py::detail::_)
+#endif
+
+TEST_SUBMODULE(const_name, m) {
+ m.def("const_name_tests", const_name_tests);
+
+#if defined(PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY)
+ m.def("underscore_tests", underscore_tests);
+#else
+ m.attr("underscore_tests") = "PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY not defined.";
+#endif
+}