aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-01-20 18:43:21 -0900
committerDavid M. Syzdek <david@syzdek.net>2022-01-20 18:43:21 -0900
commit76ecc4e308dd931a8b67a1939a8182e5e4215022 (patch)
tree82bd3638e6868b2d8ea5727c1d7ee05f7ea609c9 /tests
parent1b8caaab1438203df8a74e3074370f4e22746754 (diff)
downloadtinyrad-76ecc4e308dd931a8b67a1939a8182e5e4215022.tar.gz
tinyrad-76ecc4e308dd931a8b67a1939a8182e5e4215022.tar.bz2
tinyrad-76ecc4e308dd931a8b67a1939a8182e5e4215022.tar.xz
tinyrad-76ecc4e308dd931a8b67a1939a8182e5e4215022.zip
tests: test-array: adjusting whitespace and comments
Diffstat (limited to 'tests')
-rw-r--r--tests/test-array.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/tests/test-array.c b/tests/test-array.c
index 5371be3..b1570db 100644
--- a/tests/test-array.c
+++ b/tests/test-array.c
@@ -271,9 +271,12 @@ int main( int argc, char * argv[] )
271 return(1); 271 return(1);
272 }; 272 };
273 273
274
275 // seed random()
274 clock_gettime(CLOCK_UPTIME_RAW, &ts); 276 clock_gettime(CLOCK_UPTIME_RAW, &ts);
275 srandom((unsigned)(ts.tv_sec + ts.tv_sec)); 277 srandom((unsigned)(ts.tv_sec + ts.tv_sec));
276 278
279
277 // initialize test data 280 // initialize test data
278 our_verbose(opts, "initializing test data ..."); 281 our_verbose(opts, "initializing test data ...");
279 bzero(data, sizeof(data)); 282 bzero(data, sizeof(data));
@@ -292,29 +295,24 @@ int main( int argc, char * argv[] )
292 }; 295 };
293 }; 296 };
294 297
298
295 // populate test array 299 // populate test array
296 for(pos = 0; (pos < MY_LIST_LEN); pos++) 300 for(pos = 0; (pos < MY_LIST_LEN); pos++)
297 test[pos] = &data[pos]; 301 test[pos] = &data[pos];
298 302
299 303
300 // sort test data by value 304 // test searching by value
301 our_verbose(opts, "sorting test data by value ..."); 305 our_verbose(opts, "sorting test data by value ...");
302 qsort(test, MY_LIST_LEN, sizeof(MyData *), &my_compare_obj_value); 306 qsort(test, MY_LIST_LEN, sizeof(MyData *), &my_compare_obj_value);
303
304
305 // test searching by value
306 if ((my_test_search(opts|MY_OBJ_VALUE, test, MY_LIST_LEN))) 307 if ((my_test_search(opts|MY_OBJ_VALUE, test, MY_LIST_LEN)))
307 return(1); 308 return(1);
308 if ((my_test_search(opts|MY_KEY_VALUE, test, MY_LIST_LEN))) 309 if ((my_test_search(opts|MY_KEY_VALUE, test, MY_LIST_LEN)))
309 return(1); 310 return(1);
310 311
311 312
312 // sort test data by name 313 // test searching by name
313 our_verbose(opts, "sorting test data by name ..."); 314 our_verbose(opts, "sorting test data by name ...");
314 qsort(test, MY_LIST_LEN, sizeof(MyData *), &my_compare_obj_name); 315 qsort(test, MY_LIST_LEN, sizeof(MyData *), &my_compare_obj_name);
315
316
317 // test searching by name
318 if ((my_test_search(opts|MY_OBJ_NAME, test, MY_LIST_LEN))) 316 if ((my_test_search(opts|MY_OBJ_NAME, test, MY_LIST_LEN)))
319 return(1); 317 return(1);
320 if ((my_test_search(opts|MY_KEY_NAME, test, MY_LIST_LEN))) 318 if ((my_test_search(opts|MY_KEY_NAME, test, MY_LIST_LEN)))