/[ascend]/branches/fprops-incomp/ascend/general/test/test_ltmatrix.c
ViewVC logotype

Diff of /branches/fprops-incomp/ascend/general/test/test_ltmatrix.c

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

revision 3437 by jpye, Sat Jan 18 02:36:14 2020 UTC revision 3438 by jpye, Tue Feb 4 00:47:59 2020 UTC
# Line 21  Line 21 
21    
22  #include "test/common.h"  #include "test/common.h"
23    
24    //#define LTMATRIX_DEBUG
25    #ifdef LTMATRIX_DEBUG
26    # define TEST_LTMATRIX_PRINT(MTX) ltmatrix_debug_print(MTX)
27    #else
28    # define TEST_LTMATRIX_PRINT(MTX)
29    #endif
30    
31  #ifndef MEMUSED  #ifndef MEMUSED
32  # define MEMUSED(N) CU_TEST(ascmeminuse()==(N))  # define MEMUSED(N) CU_TEST(ascmeminuse()==(N))
33  #endif  #endif
# Line 44  static void test_ltmatrix(void){ Line 51  static void test_ltmatrix(void){
51      CU_ASSERT(matrix_upper->h!=NULL);      CU_ASSERT(matrix_upper->h!=NULL);
52      /** Read Operations */      /** Read Operations */
53      /** Done with Range checks in the Access Method. */      /** Done with Range checks in the Access Method. */
54      ltmatrix_debug_print(matrix_upper); /** Success Prints Matrix of 5x5 with all elements 0.0 */      TEST_LTMATRIX_PRINT(matrix_upper); /** Success Prints Matrix of 5x5 with all elements 0.0 */
55    
56      /** Update Operations */      /** Update Operations */
57      ltmatrix_init(matrix_upper,array);      ltmatrix_init(matrix_upper,array);
58      CU_ASSERT(ltmatrix_compare_array(matrix_upper,array)==1);      CU_ASSERT(ltmatrix_compare_array(matrix_upper,array)==1);
59      ltmatrix_debug_print(matrix_upper);  
60        TEST_LTMATRIX_PRINT(matrix_upper);
61      ltmatrix_clear(matrix_upper);      ltmatrix_clear(matrix_upper);
62      ltmatrix_debug_print(matrix_upper);      TEST_LTMATRIX_PRINT(matrix_upper);  
63    
64      /** Lower Matrix Operations */      /** Lower Matrix Operations */
65      /** Create Operations */      /** Create Operations */
# Line 61  static void test_ltmatrix(void){ Line 70  static void test_ltmatrix(void){
70      CU_ASSERT(matrix_lower->h!=NULL);      CU_ASSERT(matrix_lower->h!=NULL);
71      /** Read Operations */      /** Read Operations */
72      /** Done with Range checks in the Access Method. */      /** Done with Range checks in the Access Method. */
73      ltmatrix_debug_print(matrix_lower); /** Success Prints Matrix of 5x5 with all elements 0.0 */      TEST_LTMATRIX_PRINT(matrix_lower); /** Success Prints Matrix of 5x5 with all elements 0.0 */
74      /** Update Operations */      /** Update Operations */
75      ltmatrix_init(matrix_lower,array);      ltmatrix_init(matrix_lower,array);
76      CU_ASSERT(ltmatrix_compare_array(matrix_lower,array)==1);      CU_ASSERT(ltmatrix_compare_array(matrix_lower,array)==1);
77      ltmatrix_debug_print(matrix_lower);      TEST_LTMATRIX_PRINT(matrix_lower);
78      ltmatrix_clear(matrix_lower);      ltmatrix_clear(matrix_lower);
79      ltmatrix_debug_print(matrix_lower);      TEST_LTMATRIX_PRINT(matrix_lower);
80    
81      /** Full Matrix Operations */      /** Full Matrix Operations */
82      /** Create Operations */      /** Create Operations */
# Line 78  static void test_ltmatrix(void){ Line 87  static void test_ltmatrix(void){
87      CU_ASSERT(matrix_full->h!=NULL);      CU_ASSERT(matrix_full->h!=NULL);
88      /** Read Operations */      /** Read Operations */
89      /** Done with Range checks in the Access Method. */      /** Done with Range checks in the Access Method. */
90      ltmatrix_debug_print(matrix_full); /** Success Prints Matrix of 5x5 with all elements 0.0 */      TEST_LTMATRIX_PRINT(matrix_full); /** Success Prints Matrix of 5x5 with all elements 0.0 */
91            
92    
93      /** Pattern all the Hessian Matrices */      /** Pattern all the Hessian Matrices */
# Line 93  static void test_ltmatrix(void){ Line 102  static void test_ltmatrix(void){
102    
103      /** Print for one last time the Matrices */      /** Print for one last time the Matrices */
104    
105      ltmatrix_debug_print(matrix_lower);      TEST_LTMATRIX_PRINT(matrix_lower);
106      ltmatrix_debug_print(matrix_upper);      TEST_LTMATRIX_PRINT(matrix_upper);
107      ltmatrix_debug_print(matrix_full);      TEST_LTMATRIX_PRINT(matrix_full);
108    
109    
110      /** Delete Operations */      /** Delete Operations */
# Line 176  static void test_compare(void){ Line 185  static void test_compare(void){
185      ltmatrix *m2 = ltmatrix_create(LTMATRIX_UPPER,3);      ltmatrix *m2 = ltmatrix_create(LTMATRIX_UPPER,3);
186      ltmatrix_init(m2,(double[]){1,2,3,4,5,6});      ltmatrix_init(m2,(double[]){1,2,3,4,5,6});
187      CU_TEST(ltmatrix_compare(m1,m2)==1);      CU_TEST(ltmatrix_compare(m1,m2)==1);
188      ltmatrix_debug_print(m1);      TEST_LTMATRIX_PRINT(m1);
189      ltmatrix_destroy(m1);      ltmatrix_destroy(m1);
190      ltmatrix_destroy(m2);      ltmatrix_destroy(m2);
191      MEMUSED(0);      MEMUSED(0);

Legend:
Removed from v.3437  
changed lines
  Added in v.3438

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