B
    \
                 @   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 )nameN)r   ).0Zarg_type r   Jlib/python3.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.py
<listcomp>	   s    zcfunctype.<locals>.<listcomp>)ptZ	CFuncType
c_int_type)	arg_typesr   r   r   	cfunctype   s    r   c             C   s   t | d d|  |S )NZCPP_)r
   ZCppClassType)r   Z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 k	r | d | | ||j d S )N)r
   Z
best_matchZassertNotEqualZassertEqualtype)selfZ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   s   g | ]}t d |dqS )N)r   )r   )r   tr   r   r   r	      s    zFSignatureMatcherTest.test_cpp_reference_single_arg.<locals>.<listcomp>r         )r   r
   CReferenceTyper   c_long_typeZ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   s   g | ]}t d |dqS )N)r   )r   )r   r   r   r   r   r	   ,   s    zDSignatureMatcherTest.test_cpp_reference_two_args.<locals>.<listcomp>r   r   )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   s   g | ]}t d | g qS )zTest%d)r   )r   ir   r   r   r	   2   s    zESignatureMatcherTest.test_cpp_reference_cpp_class.<locals>.<listcomp>r   r   r   c             S   s   g | ]}t d |dqS )N)r   )r   )r   r   r   r   r   r	   8   s    )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   s   g | ]}t d | g qS )zTest%d)r   )r   r   r   r   r   r	   =   s    zMSignatureMatcherTest.test_cpp_reference_cpp_class_and_int.<locals>.<listcomp>r   r   r   c             S   s   g | ]}t d |dqS )N)r   )r   )r   r   r   r   r   r	   E   s       )r   r   r
   r   r   r   r   )r   r   r   r   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   r    r"   r   r   r   r   r      s   r   )ZunittestZCython.Compilerr   r
   ZCython.Compiler.ExprNodesr   ZCython.Compiler.PyrexTypesr   r   r   ZTestCaser   r   r   r   r   <module>   s   