Revision cea8d274 Test/pschannel_bucket_test.c

View differences:

Test/pschannel_bucket_test.c
168 168
	fprintf(stderr,"%s successfully passed!\n",__func__);
169 169
}
170 170

  
171
void pschannel_bucket_save2file_test()
172
{
173
	struct pschannel_bucket * psb = NULL;
174
	const struct pschannel * ch;
175
	int8_t res = 0;
176

  
177
	res = pschannel_bucket_save2file(psb);
178
	assert(res);
179

  
180
	psb = pschannel_bucket_new(NULL, NULL);
181
	res = pschannel_bucket_save2file(psb);
182
	assert(res);
183
	pschannel_bucket_destroy(&psb);
184

  
185
	psb = pschannel_bucket_new("/tmp/channel_test_file.csv", NULL);
186
	pschannel_bucket_insert(psb, "local_channel", "10.0.0.1", "8000", "1Mbps", "localhost/channel.sdp");
187
	res = pschannel_bucket_save2file(psb);
188
	assert(res == 0);
189
	pschannel_bucket_destroy(&psb);
190

  
191
	psb = pschannel_bucket_new("/tmp/channel_test_file_out.csv", NULL);
192
	res = pschannel_bucket_loadfile(psb);
193
	assert(res == 0);
194
	ch = pschannel_bucket_find(psb, "10.0.0.1", "8000");
195
	assert(ch);
196
	assert(res == 0);
197
	pschannel_bucket_destroy(&psb);
198

  
199
	fprintf(stderr,"%s successfully passed!\n",__func__);
200
}
201

  
171 202
int main(int argv, char ** argc)
172 203
{
173 204
	pschannel_bucket_destroy_test();
......
176 207
	pschannel_bucket_to_json_test();
177 208
	pschannel_bucket_loadfile_test();
178 209
	pschannel_load_local_streams_test();
210
	pschannel_bucket_save2file_test();
179 211
	return 0;
180 212
}

Also available in: Unified diff