aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/test-array-stack.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2022-03-08 17:22:25 -0900
committerDavid M. Syzdek <david@syzdek.net>2022-03-08 17:22:25 -0900
commit8a9bbec87523b98af1da3ed43ed03436b0ef04b1 (patch)
treecf1b7504bcaac44b5fd63a4ddb6fa95e4a523b32 /tests/test-array-stack.c
parentcc98d826f549fb77b9f4a90afdea726cf15a39f3 (diff)
downloadtinyrad-8a9bbec87523b98af1da3ed43ed03436b0ef04b1.tar.gz
tinyrad-8a9bbec87523b98af1da3ed43ed03436b0ef04b1.tar.bz2
tinyrad-8a9bbec87523b98af1da3ed43ed03436b0ef04b1.tar.xz
tinyrad-8a9bbec87523b98af1da3ed43ed03436b0ef04b1.zip
tests: replacing our_error() with trutils_error()
Diffstat (limited to 'tests/test-array-stack.c')
-rw-r--r--tests/test-array-stack.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-array-stack.c b/tests/test-array-stack.c
index de1971e..9bb1929 100644
--- a/tests/test-array-stack.c
+++ b/tests/test-array-stack.c
@@ -222,7 +222,7 @@ int main( int argc, char * argv[] )
222 { 222 {
223 for(; (pos > 0); pos--) 223 for(; (pos > 0); pos--)
224 free(data[pos-1].name); 224 free(data[pos-1].name);
225 return(our_error(opts, NULL, "out of virtual memory")); 225 return(trutils_error(opts, NULL, "out of virtual memory"));
226 }; 226 };
227 }; 227 };
228 228
@@ -242,27 +242,27 @@ int main( int argc, char * argv[] )
242 if ((x % 4) == 3) 242 if ((x % 4) == 3)
243 { 243 {
244 if ((objp = tinyrad_array_pop(list, &list_len, sizeof(MyData *))) == NULL) 244 if ((objp = tinyrad_array_pop(list, &list_len, sizeof(MyData *))) == NULL)
245 return(our_error(opts, NULL, "unable to pop from stack")); 245 return(trutils_error(opts, NULL, "unable to pop from stack"));
246 if ((strcasecmp(src[x-1]->name, (*objp)->name))) 246 if ((strcasecmp(src[x-1]->name, (*objp)->name)))
247 return(our_error(opts, NULL, "str of pop object is incorrect")); 247 return(trutils_error(opts, NULL, "str of pop object is incorrect"));
248 }; 248 };
249 249
250 // adds objects to stack 250 // adds objects to stack
251 if (tinyrad_array_push((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1) 251 if (tinyrad_array_push((void **)&list, &list_len, sizeof(MyData *), &src[x], &realloc) == -1)
252 return(our_error(opts, NULL, "failed to push object to stack")); 252 return(trutils_error(opts, NULL, "failed to push object to stack"));
253 }; 253 };
254 254
255 255
256 // loop through stack and verify data 256 // loop through stack and verify data
257 trutils_verbose(opts, "verifing stack ..."); 257 trutils_verbose(opts, "verifing stack ...");
258 if (list_len != ((MY_LIST_LEN / 4) * 3)) 258 if (list_len != ((MY_LIST_LEN / 4) * 3))
259 return(our_error(opts, NULL, "stack length is incorrect")); 259 return(trutils_error(opts, NULL, "stack length is incorrect"));
260 for(x = 0, y = 0; (x < MY_LIST_LEN); x++) 260 for(x = 0, y = 0; (x < MY_LIST_LEN); x++)
261 { 261 {
262 if ((x % 4) == 2) 262 if ((x % 4) == 2)
263 continue; 263 continue;
264 if ((strcmp(src[x]->name, list[y]->name))) 264 if ((strcmp(src[x]->name, list[y]->name)))
265 return(our_error(opts, NULL, "stack data does not match test data")); 265 return(trutils_error(opts, NULL, "stack data does not match test data"));
266 y++; 266 y++;
267 }; 267 };
268 268
@@ -271,7 +271,7 @@ int main( int argc, char * argv[] )
271 trutils_verbose(opts, "popping from stack ..."); 271 trutils_verbose(opts, "popping from stack ...");
272 while (list_len > 0) 272 while (list_len > 0)
273 if (tinyrad_array_pop(list, &list_len, sizeof(MyData *)) == NULL) 273 if (tinyrad_array_pop(list, &list_len, sizeof(MyData *)) == NULL)
274 return(our_error(opts, NULL, "unable to pop from stack")); 274 return(trutils_error(opts, NULL, "unable to pop from stack"));
275 275
276 return(0); 276 return(0);
277} 277}