Complex inplace operators test.
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 12 Nov 2010 09:22:22 +0000 (01:22 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 12 Nov 2010 09:22:22 +0000 (01:22 -0800)
tests/run/inplace.pyx

index 5bdc256fcbf9d30cf97c31afb60556c7c56e8e3a..43a417b35f649eb54eecd38afe9aa79de916a8e8 100644 (file)
@@ -147,3 +147,16 @@ def test_inplace_pydivision(int a, int b):
     """
     a %= b
     return a
+
+def test_complex_inplace(double complex x, double complex y):
+    """
+    >>> test_complex_inplace(1, 1)
+    (2+0j)
+    >>> test_complex_inplace(2, 3)
+    (15+0j)
+    >>> test_complex_inplace(2+3j, 4+5j)
+    (-16+62j)
+    """
+    x += y
+    x *= y
+    return x