/[ascend]/trunk/ascend/compiler/test/test_basics.c
ViewVC logotype

Diff of /trunk/ascend/compiler/test/test_basics.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2335 by jpye, Fri Dec 24 00:29:41 2010 UTC revision 2336 by jpye, Sun Dec 26 03:44:24 2010 UTC
# Line 83  static void test_parse_string_module(voi Line 83  static void test_parse_string_module(voi
83            
84      m = Asc_OpenStringModule(model, &status, ""/* name prefix*/);      m = Asc_OpenStringModule(model, &status, ""/* name prefix*/);
85    
86    #ifdef BASICS_DEBUG
87      CONSOLE_DEBUG("Asc_OpenStringModule returns status=%d",status);      CONSOLE_DEBUG("Asc_OpenStringModule returns status=%d",status);
88    #endif
89      CU_ASSERT(status==0); /* if successfully created */      CU_ASSERT(status==0); /* if successfully created */
90    
91    #ifdef BASICS_DEBUG
92      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));
93    #endif
94      status = zz_parse();      status = zz_parse();
95    
96    #ifdef BASICS_DEBUG
97      CONSOLE_DEBUG("zz_parse returns status=%d",status);      CONSOLE_DEBUG("zz_parse returns status=%d",status);
98    #endif
99      CU_ASSERT(status==0);      CU_ASSERT(status==0);
100    
101      struct gl_list_t *l = Asc_TypeByModule(m);      struct gl_list_t *l = Asc_TypeByModule(m);
102    #ifdef BASICS_DEBUG
103      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));
104    #endif
105    
106      CU_ASSERT(gl_length(l)==2);      CU_ASSERT(gl_length(l)==2);
107      gl_destroy(l);      gl_destroy(l);
# Line 122  static void test_instantiate_string(void Line 129  static void test_instantiate_string(void
129    
130      Asc_CompilerInit(1);      Asc_CompilerInit(1);
131      CU_ASSERT(FindType(AddSymbol("boolean"))!=NULL);      CU_ASSERT(FindType(AddSymbol("boolean"))!=NULL);
132    #ifdef BASICS_DEBUG
133      CONSOLE_DEBUG("Boolean type found OK");      CONSOLE_DEBUG("Boolean type found OK");
134    #endif
135      /* CONSOLE_DEBUG("MODEL TEXT:\n%s",model); */      /* CONSOLE_DEBUG("MODEL TEXT:\n%s",model); */
136    
137      struct module_t *m;      struct module_t *m;
# Line 141  static void test_instantiate_string(void Line 149  static void test_instantiate_string(void
149      CU_ASSERT_FATAL(sim!=NULL);      CU_ASSERT_FATAL(sim!=NULL);
150    
151      /* check the simulation name */      /* check the simulation name */
152    #ifdef BASICS_DEBUG
153      CONSOLE_DEBUG("Got simulation, name = %s",SCP(GetSimulationName(sim)));      CONSOLE_DEBUG("Got simulation, name = %s",SCP(GetSimulationName(sim)));
154    #endif
155      CU_ASSERT_FATAL(GetSimulationName(sim)==AddSymbol("sim1"));      CU_ASSERT_FATAL(GetSimulationName(sim)==AddSymbol("sim1"));
156    
157      /* check for the expected instances */      /* check for the expected instances */
# Line 181  static void test_parse_basemodel(void){ Line 191  static void test_parse_basemodel(void){
191      m = Asc_OpenModule("basemodel.a4l",&status);      m = Asc_OpenModule("basemodel.a4l",&status);
192      CU_ASSERT(status==0);      CU_ASSERT(status==0);
193    
194    #ifdef BASICS_DEBUG
195      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));
196    #endif
197      status = zz_parse();      status = zz_parse();
198    
199    #ifdef BASICS_DEBUG
200      CONSOLE_DEBUG("zz_parse returns status=%d",status);      CONSOLE_DEBUG("zz_parse returns status=%d",status);
201    #endif
202      CU_ASSERT(status==0);      CU_ASSERT(status==0);
203    
204      struct gl_list_t *l = Asc_TypeByModule(m);      struct gl_list_t *l = Asc_TypeByModule(m);
205    #ifdef BASICS_DEBUG
206      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));
207    #endif
208      gl_destroy(l);      gl_destroy(l);
209    
210      /* there are only 8 things declared in system.a4l: */      /* there are only 8 things declared in system.a4l: */
# Line 211  static void test_parse_file(void){ Line 227  static void test_parse_file(void){
227      m = Asc_OpenModule("system.a4l",&status);      m = Asc_OpenModule("system.a4l",&status);
228      CU_ASSERT(status==0);      CU_ASSERT(status==0);
229    
230    #ifdef BASICS_DEBUG
231      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));      CONSOLE_DEBUG("Beginning parse of %s",Asc_ModuleName(m));
232    #endif
233      status = zz_parse();      status = zz_parse();
234    
235    #ifdef BASICS_DEBUG
236      CONSOLE_DEBUG("zz_parse returns status=%d",status);      CONSOLE_DEBUG("zz_parse returns status=%d",status);
237    #endif
238      CU_ASSERT(status==0);      CU_ASSERT(status==0);
239    
240      struct gl_list_t *l = Asc_TypeByModule(m);      struct gl_list_t *l = Asc_TypeByModule(m);
241    #ifdef BASICS_DEBUG
242      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));      CONSOLE_DEBUG("%lu library entries loaded from %s",gl_length(l),Asc_ModuleName(m));
243    #endif
244      gl_destroy(l);      gl_destroy(l);
245    
246      /* there are only 8 things declared in system.a4l: */      /* there are only 8 things declared in system.a4l: */

Legend:
Removed from v.2335  
changed lines
  Added in v.2336

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22