switch (set->from.type)
{
+ case T_INT:
+ v->type = T_INT;
+ return 1;
+
case T_PAIR:
v->type = T_PAIR;
return 1;
if ((v1->type == T_INT) && (v2->type == T_PATH))
return as_path_contains(v2->val.ad, v1->val.i, 1);
- if (((v1->type == T_PAIR) || (v1->type == T_QUAD)) && (v2->type == T_CLIST))
+ if (((v1->type == T_INT) || (v1->type == T_PAIR) || (v1->type == T_QUAD)) && (v2->type == T_CLIST))
return int_set_contains(v2->val.ad, v1->val.i);
/* IP->Quad implicit conversion */
if (val_is_ip4(v1) && (v2->type == T_CLIST))
/* Community (or cluster) list */
struct f_val dummy;
- if ((v2.type == T_PAIR) || (v2.type == T_QUAD))
+ if ((v2.type == T_INT) || (v2.type == T_PAIR) || (v2.type == T_QUAD))
RESULT_(T_CLIST, ad, [[ int_set_add(fpool, v1.val.ad, v2.val.i) ]]);
/* IP->Quad implicit conversion */
else if (val_is_ip4(&v2))
/* Community (or cluster) list */
struct f_val dummy;
- if ((v2.type == T_PAIR) || (v2.type == T_QUAD))
+ if ((v2.type == T_INT) || (v2.type == T_PAIR) || (v2.type == T_QUAD))
RESULT_(T_CLIST, ad, [[ int_set_del(fpool, v1.val.ad, v2.val.i) ]]);
/* IP->Quad implicit conversion */
else if (val_is_ip4(&v2))
l = delete(l, [(*,(onef(5)))]);
bt_assert(l = -empty-);
+ # clist with integer values instead of community pairs
+ clist li = add(add(add(add(add(-empty-, 100), 200), 300), 400), 500);
+ bt_assert(format(li) = "(clist (0,100) (0,200) (0,300) (0,400) (0,500))");
+
+ # clist add/delete/test for integer values
+ li = delete(li, 500);
+ li = add(li, 12345678); # Same as (188,24910)
+ bt_assert(200 ~ li);
+ bt_assert(500 !~ li);
+ bt_assert(12345678 ~ li);
+ bt_assert(12345679 !~ li);
+ bt_assert(format(li) = "(clist (0,100) (0,200) (0,300) (0,400) (188,24910))");
+
+ # clist filtered through integer set
+ li = delete(li, [101..1000]);
+ bt_assert(100 ~ li);
+ bt_assert(200 !~ li);
+ bt_assert(format(li) = "(clist (0,100) (188,24910))");
+
l2 = add(l2, (3,6));
l = filter(l2, [(3,1..4)]);
l2 = filter(l2, [(3,3..6)]);