o
    f                     @   sR   d dl Z d dlmZ d dlmZ d dlmZ dd Zdd Z	G d	d
 d
e j
ZdS )    N)
PyrexTypesNameNodeCFuncTypeArgc                  G   s   t t jdd | D S )Nc                 S   s   g | ]}t d |dqS )nameNr   ).0arg_type r
   g/var/www/html/mig_web/myenv/lib/python3.10/site-packages/Cython/Compiler/Tests/TestSignatureMatching.py
<listcomp>	       zcfunctype.<locals>.<listcomp>)pt	CFuncType
c_int_type)	arg_typesr
   r
   r   	cfunctype   s   r   c                 C   s   t | d d|  |S )NCPP_)r   CppClassType)r   base_classesr
   r
   r   cppclasstype   s   r   c                   @   s8   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d ZdS )SignatureMatcherTestzJ
    Test the signature matching algorithm for overloaded signatures.
    c                 C   s2   t ||}|d ur| d | | ||j d S )N)r   
best_matchassertNotEqualassertEqualtype)selfexpected_typer   	functionsmatchr
   r
   r   assertMatches   s   z"SignatureMatcherTest.assertMatchesc                 C   s   t ttjt ttjt ttjg}dd |D }| |d tjg| | |d tjg| | |d tjg| d S )Nc                 S      g | ]}t d |dqS N)r   r   r   tr
   r
   r   r      r   zFSignatureMatcherTest.test_cpp_reference_single_arg.<locals>.<listcomp>r         )r   r   CReferenceTyper   c_long_typec_double_typer    r   function_typesr   r
   r
   r   test_cpp_reference_single_arg   s   z2SignatureMatcherTest.test_cpp_reference_single_argc                 C   s   t ttjttjt ttjttjg}dd |D }| |d tjtjg| | |d tjtjg| | |d tjtjg| d S )Nc                 S   r!   r"   r   r#   r
   r
   r   r   ,   r   zDSignatureMatcherTest.test_cpp_reference_two_args.<locals>.<listcomp>r   r%   )r   r   r'   r   r(   r    r*   r
   r
   r   test_cpp_reference_two_args$   s   z0SignatureMatcherTest.test_cpp_reference_two_argsc                 C   sx   dd t dD }tt|d tt|d g}dd |D }| |d |d g| | |d |d g| d S )Nc                 S      g | ]	}t d | g qS zTest%dr   r   ir
   r
   r   r   2       zESignatureMatcherTest.test_cpp_reference_cpp_class.<locals>.<listcomp>r&   r   r%   c                 S   r!   r"   r   r#   r
   r
   r   r   8   r   )ranger   r   r'   r    r   classesr+   r   r
   r
   r   test_cpp_reference_cpp_class1   s   z1SignatureMatcherTest.test_cpp_reference_cpp_classc                 C   s   dd t dD }tt|d tjtt|d tjtt|d tjtt|d tjg}dd |D }| |d |d tjg| | |d |d tjg| | |d |d tjg| | |d |d tjg| d S )Nc                 S   r.   r/   r0   r1   r
   r
   r   r   =   r3   zMSignatureMatcherTest.test_cpp_reference_cpp_class_and_int.<locals>.<listcomp>r&   r   r%   c                 S   r!   r"   r   r#   r
   r
   r   r   E   r      )r4   r   r   r'   r   r(   r    r5   r
   r
   r   $test_cpp_reference_cpp_class_and_int<   s    z9SignatureMatcherTest.test_cpp_reference_cpp_class_and_intN)	__name__
__module____qualname____doc__r    r,   r-   r7   r9   r
   r
   r
   r   r      s    r   )unittestCython.Compilerr   r   Cython.Compiler.ExprNodesr   Cython.Compiler.PyrexTypesr   r   r   TestCaser   r
   r
   r
   r   <module>   s    