summaryrefslogtreecommitdiff
path: root/cesar/bsu/test
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/bsu/test')
-rw-r--r--cesar/bsu/test/utest/src/bsut.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index eb437fb717..7e22d519cc 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -850,6 +850,41 @@ test_case_bsu_add_avln_array_full (test_t t)
}
void
+test_case_bsu_avln_remove (test_t t)
+{
+ test_case_begin (t, "AVLN remove");
+ test_begin (
+ t, "add and remove avlns with sta_avln setted before and after")
+ {
+ bsu_test_t ctx;
+ bsu_test_init (&ctx);
+ bool added;
+ uint i;
+ for (i = 0; i < BSU_FOREIGN_AVLNS_NB; i++)
+ {
+ bsu_avln_add (ctx.bsu, i, i, i, &added);
+ test_fail_unless (added);
+ }
+ /* sta_avln is the one removed. */
+ ctx.bsu->sta_avln = &ctx.bsu->avlns[1];
+ /* Reinitialise the sync information wrote by bsu_test_init. */
+ bsu_ntb_init (&ctx.bsu->poweron.sync);
+ bsu_avln_remove (1, 1, 1);
+ test_fail_unless (ctx.bsu->sta_avln == &ctx.bsu->poweron);
+ /* sta_avln is the first one. */
+ ctx.bsu->sta_avln = &ctx.bsu->avlns[0];
+ bsu_avln_remove (2, 2, 2);
+ test_fail_unless (ctx.bsu->sta_avln == &ctx.bsu->avlns[0]);
+ /* sta_avln is the 4th one. */
+ ctx.bsu->sta_avln = &ctx.bsu->avlns[4];
+ bsu_avln_remove (3, 3, 3);
+ test_fail_unless (ctx.bsu->sta_avln == &ctx.bsu->avlns[3]);
+ bsu_test_uninit (&ctx);
+ }
+ test_end;
+}
+
+void
test_suite_bsu (test_t t)
{
test_suite_begin (t, "BSU test");
@@ -863,4 +898,5 @@ test_suite_bsu (test_t t)
test_case_bsu_nek_index (t);
test_case_bsu_discover_update (t);
test_case_bsu_add_avln_array_full (t);
+ test_case_bsu_avln_remove (t);
}