diff options
author | Sander Vrijders <[email protected]> | 2017-01-29 15:37:23 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-01-29 15:37:23 +0000 |
commit | 4150bf0c6aa6b2bdabb43a32a3e127ae3e50507d (patch) | |
tree | eaf66f732f52d84a5daf3f6736b489c3a755a620 /src/lib/tests | |
parent | 25ce65a8a4454fca6a4206a828caeb74d0599d86 (diff) | |
parent | d6321a22f8c957523e7acbf6c57f5730b55ac378 (diff) | |
download | ouroboros-4150bf0c6aa6b2bdabb43a32a3e127ae3e50507d.tar.gz ouroboros-4150bf0c6aa6b2bdabb43a32a3e127ae3e50507d.zip |
Merged in dstaesse/ouroboros/be-rib (pull request #354)
lib: Add function to get children of node in RIB
Diffstat (limited to 'src/lib/tests')
-rw-r--r-- | src/lib/tests/rib_test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/tests/rib_test.c b/src/lib/tests/rib_test.c index 37503941..bad01083 100644 --- a/src/lib/tests/rib_test.c +++ b/src/lib/tests/rib_test.c @@ -46,6 +46,9 @@ int rib_test(int argc, char tmp[RIB_MAX_PATH_LEN]; + char ** kids; + ssize_t ch; + struct timespec t = {0, 100 * BILLION}; (void) argc; @@ -73,6 +76,16 @@ int rib_test(int argc, return -1; } + ch = rib_children("/static_info", &kids); + if (ch != 0) { + printf("Wrong number of children returned.\n"); + rib_fini(); + while (ch > 0) + free(kids[--ch]); + free(kids); + return -1; + } + if (!rib_has("/static_info")) { printf("Failed to find added element.\n"); rib_fini(); @@ -118,6 +131,17 @@ int rib_test(int argc, return -1; } + ch = rib_children("/static_info", &kids); + if (ch != 2) { + printf("Wrong number of children returned.\n"); + rib_fini(); + return -1; + } + + while (ch > 0) + free(kids[--ch]); + free(kids); + if (addr_chk != addr_size) { printf("Failed to verify added element contents.\n"); rib_fini(); |