ó
ŠV]c           @   sk   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d   Z d   Z	 d e  j
 f d     YZ d S(	   iÿÿÿÿN(   t
   PyrexTypes(   t   NameNode(   t   CFuncTypeArgc          G   s2   t  j t  j g  |  D] } t d | d   ^ q  S(   Nt   name(   t   ptt	   CFuncTypet
   c_int_typeR   t   None(   t	   arg_typest   arg_type(    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt	   cfunctype   s    c         C   s   t  j |  d  d |  |  S(   Nt   CPP_(   R   t   CppClassTypeR   (   R   t   base_classes(    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   cppclasstype   s    t   SignatureMatcherTestc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   sJ   
    Test the signature matching algorithm for overloaded signatures.
    c         C   sH   t  j | |  } | d  k	 r1 |  j d  |  n  |  j | | j  d  S(   N(   R   t
   best_matchR   t   assertNotEqualt   assertEqualt   type(   t   selft   expected_typeR   t	   functionst   match(    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   assertMatches   s    c         C   sÅ   t  t j t j   t  t j t j   t  t j t j   g } g  | D] } t d  d | ^ qL } |  j | d t j g |  |  j | d t j g |  |  j | d t j g |  d  S(   NR   i    i   i   (	   R
   R   t   CReferenceTypeR   t   c_long_typet   c_double_typeR   R   R   (   R   t   function_typest   tR   (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   test_cpp_reference_single_arg   s    %c         C   sà   t  t j t j  t j t j   t  t j t j  t j t j   g } g  | D] } t d  d | ^ qU } |  j | d t j t j g |  |  j | d t j t j g |  |  j | d t j t j g |  d  S(   NR   i    i   (   R
   R   R   R   R   R   R   R   (   R   R   R   R   (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   test_cpp_reference_two_args$   s    !'%##c         C   sÃ   g  t  d  D] } t d | g   ^ q } t t j | d   t t j | d   g } g  | D] } t d  d | ^ qe } |  j | d | d g |  |  j | d | d g |  d  S(   Ni   s   Test%di    i   R   (   t   rangeR   R
   R   R   R   R   R   (   R   t   it   classesR   R   R   (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   test_cpp_reference_cpp_class1   s    ,%c         C   s[  g  t  d  D] } t d | g   ^ q } t t j | d  t j  t t j | d  t j  t t j | d  t j  t t j | d  t j  g } g  | D] } t d  d | ^ q© } |  j	 | d | d t j g |  |  j	 | d | d t j g |  |  j	 | d | d t j g |  |  j	 | d | d t j g |  d  S(   Ni   s   Test%di    i   R   i   (
   R    R   R
   R   R   R   R   R   R   R   (   R   R!   R"   R   R   R   (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt$   test_cpp_reference_cpp_class_and_int<   s    ,"%$$$(   t   __name__t
   __module__t   __doc__R   R   R   R#   R$   (    (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyR      s   				(   t   unittestt   Cython.CompilerR    R   t   Cython.Compiler.ExprNodesR   t   Cython.Compiler.PyrexTypesR   R
   R   t   TestCaseR   (    (    (    sJ   lib/python2.7/site-packages/Cython/Compiler/Tests/TestSignatureMatching.pyt   <module>   s   		