- struct bgp_info *new_best, *old_best, *mpath;
- struct list mp_list;
- struct bgp_maxpaths_cfg mp_cfg = { 3, 3 };
- int test_result = TEST_PASSED;
- bgp_mp_list_init (&mp_list);
- bgp_mp_list_add (&mp_list, &test_mp_list_info[4]);
- bgp_mp_list_add (&mp_list, &test_mp_list_info[3]);
- bgp_mp_list_add (&mp_list, &test_mp_list_info[0]);
- bgp_mp_list_add (&mp_list, &test_mp_list_info[1]);
- new_best = &test_mp_list_info[3];
- old_best = NULL;
- bgp_info_mpath_update (&test_rn, new_best, old_best, &mp_list, &mp_cfg);
- bgp_mp_list_clear (&mp_list);
- EXPECT_TRUE (bgp_info_mpath_count (new_best) == 2, test_result);
- mpath = bgp_info_mpath_first (new_best);
- EXPECT_TRUE (mpath == &test_mp_list_info[0], test_result);
- EXPECT_TRUE (CHECK_FLAG (mpath->flags, BGP_INFO_MULTIPATH), test_result);
- mpath = bgp_info_mpath_next (mpath);
- EXPECT_TRUE (mpath == &test_mp_list_info[1], test_result);
- EXPECT_TRUE (CHECK_FLAG (mpath->flags, BGP_INFO_MULTIPATH), test_result);
-
- bgp_mp_list_add (&mp_list, &test_mp_list_info[0]);
- bgp_mp_list_add (&mp_list, &test_mp_list_info[1]);
- new_best = &test_mp_list_info[0];
- old_best = &test_mp_list_info[3];
- bgp_info_mpath_update (&test_rn, new_best, old_best, &mp_list, &mp_cfg);
- bgp_mp_list_clear (&mp_list);
- EXPECT_TRUE (bgp_info_mpath_count (new_best) == 1, test_result);
- mpath = bgp_info_mpath_first (new_best);
- EXPECT_TRUE (mpath == &test_mp_list_info[1], test_result);
- EXPECT_TRUE (CHECK_FLAG (mpath->flags, BGP_INFO_MULTIPATH), test_result);
- EXPECT_TRUE (!CHECK_FLAG (test_mp_list_info[0].flags, BGP_INFO_MULTIPATH),
- test_result);
-
- return test_result;
+ struct bgp_info *new_best, *old_best, *mpath;
+ struct list mp_list;
+ struct bgp_maxpaths_cfg mp_cfg = {3, 3};
+ int test_result = TEST_PASSED;
+ bgp_mp_list_init(&mp_list);
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[4]);
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[3]);
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[0]);
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
+ new_best = &test_mp_list_info[3];
+ old_best = NULL;
+ bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+ bgp_mp_list_clear(&mp_list);
+ EXPECT_TRUE(bgp_info_mpath_count(new_best) == 2, test_result);
+ mpath = bgp_info_mpath_first(new_best);
+ EXPECT_TRUE(mpath == &test_mp_list_info[0], test_result);
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
+ mpath = bgp_info_mpath_next(mpath);
+ EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
+
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[0]);
+ bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
+ new_best = &test_mp_list_info[0];
+ old_best = &test_mp_list_info[3];
+ bgp_info_mpath_update(&test_rn, new_best, old_best, &mp_list, &mp_cfg);
+ bgp_mp_list_clear(&mp_list);
+ EXPECT_TRUE(bgp_info_mpath_count(new_best) == 1, test_result);
+ mpath = bgp_info_mpath_first(new_best);
+ EXPECT_TRUE(mpath == &test_mp_list_info[1], test_result);
+ EXPECT_TRUE(CHECK_FLAG(mpath->flags, BGP_INFO_MULTIPATH), test_result);
+ EXPECT_TRUE(!CHECK_FLAG(test_mp_list_info[0].flags, BGP_INFO_MULTIPATH),
+ test_result);
+
+ return test_result;