about summary refs log tree commit diff
path: root/.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-4a52a71956a8d46fcb7294ac71734504bb09bcc2.tar.gz
two version of R2R are here HEAD master
Diffstat (limited to '.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py')
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py b/.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py
new file mode 100644
index 00000000..594bd7ca
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/f2py/tests/test_isoc.py
@@ -0,0 +1,52 @@
+from . import util
+import numpy as np
+import pytest
+from numpy.testing import assert_allclose
+
+class TestISOC(util.F2PyTest):
+    sources = [
+        util.getpath("tests", "src", "isocintrin", "isoCtests.f90"),
+    ]
+
+    # gh-24553
+    def test_c_double(self):
+        out = self.module.coddity.c_add(1, 2)
+        exp_out = 3
+        assert  out == exp_out
+
+    # gh-9693
+    def test_bindc_function(self):
+        out = self.module.coddity.wat(1, 20)
+        exp_out = 8
+        assert  out == exp_out
+
+    # gh-25207
+    def test_bindc_kinds(self):
+        out = self.module.coddity.c_add_int64(1, 20)
+        exp_out = 21
+        assert  out == exp_out
+
+    # gh-25207
+    def test_bindc_add_arr(self):
+        a = np.array([1,2,3])
+        b = np.array([1,2,3])
+        out = self.module.coddity.add_arr(a, b)
+        exp_out = a*2
+        assert_allclose(out, exp_out)
+
+
+def test_process_f2cmap_dict():
+    from numpy.f2py.auxfuncs import process_f2cmap_dict
+
+    f2cmap_all = {"integer": {"8": "rubbish_type"}}
+    new_map = {"INTEGER": {"4": "int"}}
+    c2py_map = {"int": "int", "rubbish_type": "long"}
+
+    exp_map, exp_maptyp = ({"integer": {"8": "rubbish_type", "4": "int"}}, ["int"])
+
+    # Call the function
+    res_map, res_maptyp = process_f2cmap_dict(f2cmap_all, new_map, c2py_map)
+
+    # Assert the result is as expected
+    assert res_map == exp_map
+    assert res_maptyp == exp_maptyp