diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-01-27 14:37:00 -0900 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-01-27 14:37:00 -0900 |
| commit | 7252c8d1e7de7338a30393f8107e07828d45a6de (patch) | |
| tree | 757a02eb067e8a033ddf2bb7c6392b10d8b45af4 /tests/test-array-queue.c | |
| parent | 2482489e4d8ff94e5727d8434213071580f00e95 (diff) | |
| download | tinyrad-7252c8d1e7de7338a30393f8107e07828d45a6de.tar.gz tinyrad-7252c8d1e7de7338a30393f8107e07828d45a6de.tar.bz2 tinyrad-7252c8d1e7de7338a30393f8107e07828d45a6de.tar.xz tinyrad-7252c8d1e7de7338a30393f8107e07828d45a6de.zip | |
tests: updating our_error() to accept array of error strings
Diffstat (limited to 'tests/test-array-queue.c')
| -rw-r--r-- | tests/test-array-queue.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-array-queue.c b/tests/test-array-queue.c index c9d9995..5d70c1d 100644 --- a/tests/test-array-queue.c +++ b/tests/test-array-queue.c | |||
| @@ -219,7 +219,7 @@ int main( int argc, char * argv[] ) | |||
| 219 | { | 219 | { |
| 220 | for(; (pos > 0); pos--) | 220 | for(; (pos > 0); pos--) |
| 221 | free(data[pos-1].name); | 221 | free(data[pos-1].name); |
| 222 | return(our_error(opts, "out of virtual memory")); | 222 | return(our_error(opts, NULL, "out of virtual memory")); |
| 223 | }; | 223 | }; |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| @@ -239,26 +239,26 @@ int main( int argc, char * argv[] ) | |||
| 239 | if ((x % 4) == 3) | 239 | if ((x % 4) == 3) |
| 240 | { | 240 | { |
| 241 | if ((objp = tinyrad_array_dequeue(list, &list_len, sizeof(MyData *))) == NULL) | 241 | if ((objp = tinyrad_array_dequeue(list, &list_len, sizeof(MyData *))) == NULL) |
| 242 | return(our_error(opts, "unable to dequeue from queue")); | 242 | return(our_error(opts, NULL, "unable to dequeue from queue")); |
| 243 | if ((strcasecmp(src[x/4]->name, (*objp)->name))) | 243 | if ((strcasecmp(src[x/4]->name, (*objp)->name))) |
| 244 | return(our_error(opts, "str of dequeued object is incorrect")); | 244 | return(our_error(opts, NULL, "str of dequeued object is incorrect")); |
| 245 | }; | 245 | }; |
| 246 | 246 | ||
| 247 | // adds objects to queue | 247 | // adds objects to queue |
| 248 | if (tinyrad_array_enqueue((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1) | 248 | if (tinyrad_array_enqueue((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1) |
| 249 | return(our_error(opts, "failed to enqueue object to queue")); | 249 | return(our_error(opts, NULL, "failed to enqueue object to queue")); |
| 250 | }; | 250 | }; |
| 251 | 251 | ||
| 252 | 252 | ||
| 253 | // loop through queue and verify data | 253 | // loop through queue and verify data |
| 254 | our_verbose(opts, "verifing queue ..."); | 254 | our_verbose(opts, "verifing queue ..."); |
| 255 | if (list_len != ((MY_LIST_LEN / 4) * 3)) | 255 | if (list_len != ((MY_LIST_LEN / 4) * 3)) |
| 256 | return(our_error(opts, "queue length is incorrect")); | 256 | return(our_error(opts, NULL, "queue length is incorrect")); |
| 257 | delta = MY_LIST_LEN - list_len; | 257 | delta = MY_LIST_LEN - list_len; |
| 258 | for(x = delta; (x < MY_LIST_LEN); x++) | 258 | for(x = delta; (x < MY_LIST_LEN); x++) |
| 259 | { | 259 | { |
| 260 | if ((strcmp(src[x]->name, list[list_len-x+delta-1]->name))) | 260 | if ((strcmp(src[x]->name, list[list_len-x+delta-1]->name))) |
| 261 | return(our_error(opts, "queue data does not match test data")); | 261 | return(our_error(opts, NULL, "queue data does not match test data")); |
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | 264 | ||
| @@ -266,7 +266,7 @@ int main( int argc, char * argv[] ) | |||
| 266 | our_verbose(opts, "dequeueing from queue ..."); | 266 | our_verbose(opts, "dequeueing from queue ..."); |
| 267 | while (list_len > 0) | 267 | while (list_len > 0) |
| 268 | if (tinyrad_array_dequeue(list, &list_len, sizeof(MyData *)) == NULL) | 268 | if (tinyrad_array_dequeue(list, &list_len, sizeof(MyData *)) == NULL) |
| 269 | return(our_error(opts, "unable to dequeue from queue")); | 269 | return(our_error(opts, NULL, "unable to dequeue from queue")); |
| 270 | 270 | ||
| 271 | return(0); | 271 | return(0); |
| 272 | } | 272 | } |
