/[ascend]/trunk/ascend/solver/test/test_qrslv.c
ViewVC logotype

Diff of /trunk/ascend/solver/test/test_qrslv.c

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

revision 2641 by jpye, Sun Sep 30 12:36:07 2012 UTC revision 2642 by jpye, Tue Oct 2 09:31:20 2012 UTC
# Line 138  static void test_bug513_no_simplify(void Line 138  static void test_bug513_no_simplify(void
138      test_qrslv("bug513",0);      test_qrslv("bug513",0);
139  }  }
140    
141    /* http://ascend4.org/b567, sim_destroy crash (seen at r4354 in trunk). */
142    static void test_bug567(void){
143    
144  /* test for mysterious crash during solution (64-bit) which also results in      Asc_CompilerInit(1);
145  side-effect of FIXed values being changed by the solver (32-bit)! */      CU_TEST(0 == Asc_PutEnv(ASC_ENV_LIBRARY "=models"));
146        CU_TEST(0 == Asc_PutEnv(ASC_ENV_SOLVERS "=solvers/qrslv"));
147        char *lib = Asc_GetEnv(ASC_ENV_LIBRARY);
148        CONSOLE_DEBUG("%s = %s\n",ASC_ENV_LIBRARY,lib);
149        ASC_FREE(lib);
150    
151        package_load("qrslv",NULL);
152    
153        /* load the file */
154        const char *path = "models/johnpye/fprops/brayton_split.a4c";
155        int status;
156        Asc_OpenModule(path,&status);
157        CU_ASSERT(status == 0);
158        if(status){
159            Asc_CompilerDestroy();
160            CU_FAIL_FATAL(failed to load module);
161        }
162    
163        /* parse it */
164        CU_ASSERT(0 == zz_parse());
165    
166        /* find the model */
167        const char *simtype = "brayton_split_co2";
168        CU_ASSERT(FindType(AddSymbol(simtype))!=NULL);
169    
170        /* instantiate it */
171        struct Instance *siminst = SimsCreateInstance(AddSymbol(simtype), AddSymbol("sim1"), e_normal, NULL);
172        CU_ASSERT_FATAL(siminst!=NULL);
173    
174        /* destroy all that stuff */
175        CONSOLE_DEBUG("Destroying instance tree");
176        CU_ASSERT(siminst != NULL);
177    
178        solver_destroy_engines();
179        sim_destroy(siminst);
180        Asc_CompilerDestroy();
181    }
182    
183    /* http://ascend4.org/b564 error in solution of model; the
184    solver causes fixed variables to change to crazy values, looks like a memory
185    management problem of some sort. */
186  static void test_bug564(void){  static void test_bug564(void){
187    
188      Asc_CompilerInit(1);      Asc_CompilerInit(1);
# Line 176  static void test_bug564(void){ Line 217  static void test_bug564(void){
217      struct Instance *siminst = SimsCreateInstance(AddSymbol(simtype), AddSymbol("sim1"), e_normal, NULL);      struct Instance *siminst = SimsCreateInstance(AddSymbol(simtype), AddSymbol("sim1"), e_normal, NULL);
218      CU_ASSERT_FATAL(siminst!=NULL);      CU_ASSERT_FATAL(siminst!=NULL);
219    
 #if 0  
220      CONSOLE_DEBUG("RUNNING ON_LOAD");      CONSOLE_DEBUG("RUNNING ON_LOAD");
221    
222      /** Call on_load */      /** Call on_load */
# Line 214  static void test_bug564(void){ Line 254  static void test_bug564(void){
254      name = CreateIdName(AddSymbol("self_test"));      name = CreateIdName(AddSymbol("self_test"));
255      pe = Initialize(GetSimulationRoot(siminst),name,"sim1", ASCERR, WP_STOPONERR, NULL, NULL);      pe = Initialize(GetSimulationRoot(siminst),name,"sim1", ASCERR, WP_STOPONERR, NULL, NULL);
256      CU_ASSERT(pe==Proc_all_ok);      CU_ASSERT(pe==Proc_all_ok);
 #endif  
257    
258      /* destroy all that stuff */      /* destroy all that stuff */
259      CONSOLE_DEBUG("Destroying instance tree");      CONSOLE_DEBUG("Destroying instance tree");
260      CU_ASSERT(siminst != NULL);      CU_ASSERT(siminst != NULL);
261    
262      solver_destroy_engines();      solver_destroy_engines();
     sim_destroy(siminst);  
263      Asc_CompilerDestroy();      Asc_CompilerDestroy();
   
264  }  }
265    
266  /*===========================================================================*/  /*===========================================================================*/
# Line 232  static void test_bug564(void){ Line 269  static void test_bug564(void){
269  #define TESTS1(T,X) \  #define TESTS1(T,X) \
270      T(bug513_no_simplify) \      T(bug513_no_simplify) \
271      X T(bug513_simplify) \      X T(bug513_simplify) \
272        X T(bug567) \
273      X T(bug564)      X T(bug564)
274    
275  #define X  #define X

Legend:
Removed from v.2641  
changed lines
  Added in v.2642

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