Revision d6fa79fc Matrix/Test/matrix_test.c

View differences:

Matrix/Test/matrix_test.c
115 115
{
116 116
	FILE *fp;
117 117
	struct matrix *m;
118
	matsize i;
118 119

  
119 120
	write_edgefile();
120 121
	m = matrix_from_edgefile("net.edges");
......
125 126

  
126 127
	matrix_destroy(&m);
127 128

  
129
	m = matrix_ones(1, 5);
130
	matrix_shrink(&m, 2);
131
	assert(matrix_num_rows(m) == 1);
132
	assert(matrix_num_cols(m) == 4);
133
	for(i = 0; i < matrix_num_cols(m); i++)
134
		assert(matrix_element_get(m, 0, i) == 1);
135
	matrix_destroy(&m);
136

  
137
	m = matrix_ones(5, 1);
138
	matrix_shrink(&m, 2);
139
	assert(matrix_num_rows(m) == 4);
140
	assert(matrix_num_cols(m) == 1);
141
	for(i = 0; i < matrix_num_cols(m); i++)
142
		assert(matrix_element_get(m, i, 0) == 1);
143
	matrix_destroy(&m);
144

  
145
	m = matrix_ones(1, 5);
146
	matrix_shrink(&m, 0);
147
	assert(matrix_num_rows(m) == 1);
148
	assert(matrix_num_cols(m) == 4);
149
	for(i = 0; i < matrix_num_cols(m); i++)
150
		assert(matrix_element_get(m, 0, i) == 1);
151
	matrix_destroy(&m);
152

  
153
	m = matrix_ones(5, 1);
154
	matrix_shrink(&m, 0);
155
	assert(matrix_num_rows(m) == 4);
156
	assert(matrix_num_cols(m) == 1);
157
	for(i = 0; i < matrix_num_cols(m); i++)
158
		assert(matrix_element_get(m, i, 0) == 1);
159
	matrix_destroy(&m);
160

  
128 161
	fprintf(stderr,"%s successfully passed!\n",__func__);
129 162
}
130 163

  

Also available in: Unified diff