o
    g                     @   s6   d dl Z ddlmZ d dlmZ G dd dejZdS )    N   )util)crackfortranc                   @   s2   e Zd ZdZddgZedZdd Zdd Z	d	S )
TestAbstractInterfacez.f90add1add2a  
        module ops_module

          abstract interface
            subroutine op(x, y, z)
              integer, intent(in) :: x, y
              integer, intent(out) :: z
            end subroutine
          end interface

        contains

          subroutine foo(x, y, r1, r2)
            integer, intent(in) :: x, y
            integer, intent(out) :: r1, r2
            procedure (op) add1, add2
            procedure (op), pointer::p
            p=>add1
            call p(x, y, r1)
            p=>add2
            call p(x, y, r2)
          end subroutine
        end module

        subroutine add1(x, y, z)
          integer, intent(in) :: x, y
          integer, intent(out) :: z
          z = x + y
        end subroutine

        subroutine add2(x, y, z)
          integer, intent(in) :: x, y
          integer, intent(out) :: z
          z = x + 2 * y
        end subroutine
        c                 C   s   | j jdddksJ d S )N      )      )module
ops_modulefoo)self r   f/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/numpy/f2py/tests/test_abstract_interface.pytest_abstract_interface0   s   z-TestAbstractInterface.test_abstract_interfacec                 C   s   |d }| d}|td W d    n1 sw   Y  tt|g}t|dks1J t|d d dks=J |d d d d dksKJ d S )	Nzgh18403_mod.f90wz                module test
                  abstract interface
                    subroutine foo()
                    end subroutine
                  end interface
                end module test
                r   r   bodyblockzabstract interface)openwritetextwrapdedentr   strlen)r   tmp_pathf_pathffmodr   r   r   test_parse_abstract_interface3   s   	 z3TestAbstractInterface.test_parse_abstract_interfaceN)
__name__
__module____qualname__suffixskipr   r   coder   r    r   r   r   r   r      s    
%r   )r    r   
numpy.f2pyr   F2PyTestr   r   r   r   r   <module>   s    