summaryrefslogtreecommitdiff
path: root/tests/run/cpp_stl_cmath_cpp17.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/cpp_stl_cmath_cpp17.pyx')
-rw-r--r--tests/run/cpp_stl_cmath_cpp17.pyx34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/run/cpp_stl_cmath_cpp17.pyx b/tests/run/cpp_stl_cmath_cpp17.pyx
new file mode 100644
index 000000000..d6e2cc33b
--- /dev/null
+++ b/tests/run/cpp_stl_cmath_cpp17.pyx
@@ -0,0 +1,34 @@
+# mode: run
+# tag: cpp, werror, cpp17
+
+from libcpp.cmath cimport beta, legendre, hypot
+
+def test_beta(double x, double y):
+ """
+ Test C++17 std::beta function
+ >>> test_beta(1.0, 1.0)
+ 1.0
+ >>> test_beta(1.0, 2.0)
+ 0.5
+ """
+ return beta(x, y)
+
+def test_legendre(int x, double y):
+ """
+ Test C++17 std::legendre function
+ >>> test_legendre(1, 0.5)
+ 0.5
+ >>> test_legendre(2, 0.5)
+ -0.125
+ """
+ return legendre(x, y)
+
+def test_hypot(double x, double y, double z):
+ """
+ Test C++17 std::hypot function
+ >>> test_hypot(1.0, 2.0, 2.0)
+ 3.0
+ >>> test_hypot(3.0, 4.0, 0.0)
+ 5.0
+ """
+ return hypot(x, y, z) \ No newline at end of file