diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-03-07 18:42:41 +0100 |
---|---|---|
committer | Jan Moskyto Matejka <mq@ucw.cz> | 2017-03-09 13:47:00 +0100 |
commit | 7126cadf80fce1af2bb4aa33f8bcb7c6b5ff1a47 (patch) | |
tree | a1603efe3e773106b08ba5b2766af2e5406dcd5b /lib/buffer_test.c | |
parent | 5ffb62dd034db0beab5ef245ad7dd31aadefb2d8 (diff) |
Static: Minor overhaul
The patch fixes several bugs introduced in previous changes, simplifies
the protocol by handing routes uniformly, introduces asynchronous route
processing to avoid issues with separate notifications for each next-hop
in ECMP routes, and makes reconfiguration faster by avoiding quadratic
complexity.
Diffstat (limited to 'lib/buffer_test.c')
-rw-r--r-- | lib/buffer_test.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/buffer_test.c b/lib/buffer_test.c index 55179e82..5b7de330 100644 --- a/lib/buffer_test.c +++ b/lib/buffer_test.c @@ -133,6 +133,25 @@ t_buffer_flush(void) return 1; } +static int +t_buffer_walk(void) +{ + int i; + + init_buffer(); + fill_expected_array(); + for (i = 0; i < MAX_NUM; i++) + BUFFER_PUSH(buf) = expected[i]; + + i = 0; + BUFFER_WALK(buf, v) + bt_assert(v == expected[i++]); + + bt_assert(i == MAX_NUM); + + return 1; +} + int main(int argc, char *argv[]) { @@ -142,6 +161,7 @@ main(int argc, char *argv[]) bt_test_suite(t_buffer_pop, "Fill whole buffer (PUSH), a half of elements POP and PUSH new elements"); bt_test_suite(t_buffer_resize, "Init a small buffer and try overfill"); bt_test_suite(t_buffer_flush, "Fill and flush all elements"); + bt_test_suite(t_buffer_walk, "Fill and walk through buffer"); return bt_exit_value(); } |