a
    hŻEb  ć                   @   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.f90Zadd1Z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é   é   )é   é   )ŚmoduleZ
ops_moduleZfoo)Śself© r   śh/home/ja/django-apps/lartica_env/lib/python3.9/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 s80    Y  t t|g”}t|dksbJ t|d d dkszJ |d d d d dksJ 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   Ztmp_pathZ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   Z
numpy.f2pyr   ZF2PyTestr   r   r   r   r   Ś<module>   s   