#NEWLINE# def test_dummy_loops_c( ) : #NEWLINE# #INDENT# from sympy.tensor import IndexedBase , Idx #NEWLINE# ( i , m ) = symbols ( 'i m' , integer = True , cls = Dummy ) #NEWLINE# x = IndexedBase ( 'x' ) #NEWLINE# y = IndexedBase ( 'y' ) #NEWLINE# i = Idx ( i , m ) #NEWLINE# expected = ( '#include "file.h"\n#include <math.h>\nvoid test_dummies(int m_%(mno)i, double *x, double *y) {\n   for (int i_%(ino)i=0; i_%(ino)i<m_%(mno)i; i_%(ino)i++){\n      y[i_%(ino)i] = x[i_%(ino)i];\n   }\n}\n' % { #NEWLINE# #INDENT# 'ino' : i . label . dummy_index , #NEWLINE# 'mno' : m . dummy_index , #NEWLINE# #UNINDENT# } ) #NEWLINE# r = make_routine ( 'test_dummies' , Eq ( y [ i ] , x [ i ] ) ) #NEWLINE# c = CCodeGen ( ) #NEWLINE# code = get_string ( c . dump_c , [ r ] ) #NEWLINE# assert ( code == expected )