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 |
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 */ |
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 */ |
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 */ |
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 */ |
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); |