ó
Ąź\c           @   sţ   d  d l  m Z d  d l m Z d  d l m Z m Z m Z m Z d  d l	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z e d  \ Z Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z  d S(   i˙˙˙˙(   t   symbols(   t   ccode(   t   Declarationt   Variablet   float64t   int64(   t   alignoft   CommaOperatort   gotot   Labelt   PreDecrementt   PostDecrementt   PreIncrementt   PostIncrementt   sizeoft   uniont   structs   x yc          C   sF   t  t  }  t |   d k s$ t  |  j |  j   |  k sB t  d  S(   Ns
   alignof(x)(   R   t   xR   t   AssertionErrort   funct   args(   t   ax(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_alignof   s    c          C   sS   t  t t  d t  }  t |   d k s1 t  |  j |  j   |  k sO t  d  S(   Ni   s   (++(x), 2*x)(   R   R   R   R   R   R   R   (   t   expr(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_CommaOperator   s    c          C   sÜ   d }  t  |   } | j | j   | k s0 t  | t  d  k sH t  t |  d k s` t  t |   } | j s{ t  t |  d k s t  | j | k s¨ t  | t |   k sŔ t  | t d  k sŘ t  d  S(   Nt
   early_exitt   foobars   goto early_exits   early_exit:(   R   R   R   R   R   R	   t   is_Atomt   label(   t   st   gt   l(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_goto_Label   s    c          C   sF   t  t  }  |  j |  j   |  k s* t  t |   d k sB t  d  S(   Ns   --(x)(   R
   R   R   R   R   R   (   t   p(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_PreDecrement'   s    c          C   sF   t  t  }  |  j |  j   |  k s* t  t |   d k sB t  d  S(   Ns   (x)--(   R   R   R   R   R   R   (   R!   (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_PostDecrement-   s    c          C   sF   t  t  }  |  j |  j   |  k s* t  t |   d k sB t  d  S(   Ns   ++(x)(   R   R   R   R   R   R   (   R!   (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_PreIncrement3   s    c          C   sF   t  t  }  |  j |  j   |  k s* t  t |   d k sB t  d  S(   Ns   (x)++(   R   R   R   R   R   R   (   R!   (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_PostIncrement9   s    c             s   d   t     }  t |   d   k s. t  |  j |  j   |  k sL t  |  j s\ t  t   f d   |  j   D  s t  d  S(   Ns   unsigned ints
   sizeof(%s)c         3   s   |  ] } |   k Vq d  S(   N(    (   t   .0t   atom(   t   typename(    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pys	   <genexpr>E   s    (   R   R   R   R   R   R   t   allt   atoms(   t   sz(    (   R(   s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_sizeof?   s    c          C   s  t  t d t t  t d t }  } t d |  | g  } | j | j   | k sX t  | t d |  | f  k sy t  | t d | |  f  k s t  t | j	  d k sľ t  t
 | j  d k sĐ t  t d   | j D  sď t  t |  d k st  d  S(   Nt   typet   vec2i   c         s   s   |  ] } t  | t  Vq d  S(   N(   t
   isinstanceR   (   R&   t   arg(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pys	   <genexpr>P   s    s)   struct vec2 {
   double x;
   double y;
}(   R   R   R   t   yR   R   R   R   t   strt   namet   lent   declarationsR)   R   (   t   vxt   vyR   (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   test_structH   s    %!!	c          C   sę   t  t d t t  t d t }  } t d |  | g  } | j | j   | k sX t  | t d |  | f  k sy t  t	 | j
  d k s t  t | j  d k sŻ t  t d   | j D  sÎ t  t |  d k sć t  d  S(   NR-   t   dualusei   c         s   s   |  ] } t  | t  Vq d  S(   N(   R/   R   (   R&   R0   (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pys	   <genexpr>_   s    s,   union dualuse {
   double x;
   int64_t y;
}(   R   R   R   R1   R   R   R   R   R   R2   R3   R4   R5   R)   R   (   R6   R7   t   u(    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt
   test_unionX   s    %!	N(!   t   sympy.core.symbolR    t   sympy.printing.ccodeR   t   sympy.codegen.astR   R   R   R   t   sympy.codegen.cnodesR   R   R   R	   R
   R   R   R   R   R   R   R   R1   R   R   R    R"   R#   R$   R%   R,   R8   R;   (    (    (    s>   lib/python2.7/site-packages/sympy/codegen/tests/test_cnodes.pyt   <module>   s   "L										