forked from Mirror/frr
Merge pull request #12849 from opensourcerouting/fix/tests_enum
tests: Cover all enum values for unit tests
This commit is contained in:
commit
39c664c4ea
|
@ -650,21 +650,14 @@ static const char *str_from_afi(afi_t afi)
|
||||||
return "ipv4";
|
return "ipv4";
|
||||||
case AFI_IP6:
|
case AFI_IP6:
|
||||||
return "ipv6";
|
return "ipv6";
|
||||||
default:
|
case AFI_L2VPN:
|
||||||
return "<unknown AFI>";
|
return "l2vpn";
|
||||||
|
case AFI_MAX:
|
||||||
|
case AFI_UNSPEC:
|
||||||
|
return "bad-value";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static const char *str_from_safi(safi_t safi)
|
assert(!"Reached end of function we should never reach");
|
||||||
{
|
|
||||||
switch (safi) {
|
|
||||||
case SAFI_UNICAST:
|
|
||||||
return "unicast";
|
|
||||||
case SAFI_MULTICAST:
|
|
||||||
return "multicast";
|
|
||||||
default:
|
|
||||||
return "<unknown SAFI>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *str_from_attr_type(enum test_peer_attr_type at)
|
static const char *str_from_attr_type(enum test_peer_attr_type at)
|
||||||
|
@ -1150,7 +1143,7 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)
|
||||||
test_log(test, "prepare: switch address-family to [%s]",
|
test_log(test, "prepare: switch address-family to [%s]",
|
||||||
get_afi_safi_str(pa->afi, pa->safi, false));
|
get_afi_safi_str(pa->afi, pa->safi, false));
|
||||||
test_execute(test, "address-family %s %s",
|
test_execute(test, "address-family %s %s",
|
||||||
str_from_afi(pa->afi), str_from_safi(pa->safi));
|
str_from_afi(pa->afi), safi2str(pa->safi));
|
||||||
test_execute(test, "neighbor %s activate", g->name);
|
test_execute(test, "neighbor %s activate", g->name);
|
||||||
test_execute(test, "neighbor %s activate", p->host);
|
test_execute(test, "neighbor %s activate", p->host);
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1210,7 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)
|
||||||
test_log(test, "prepare: switch address-family to [%s]",
|
test_log(test, "prepare: switch address-family to [%s]",
|
||||||
get_afi_safi_str(pa->afi, pa->safi, false));
|
get_afi_safi_str(pa->afi, pa->safi, false));
|
||||||
test_execute(test, "address-family %s %s",
|
test_execute(test, "address-family %s %s",
|
||||||
str_from_afi(pa->afi), str_from_safi(pa->safi));
|
str_from_afi(pa->afi), safi2str(pa->safi));
|
||||||
test_execute(test, "neighbor %s activate", g->name);
|
test_execute(test, "neighbor %s activate", g->name);
|
||||||
test_execute(test, "neighbor %s activate", p->host);
|
test_execute(test, "neighbor %s activate", p->host);
|
||||||
}
|
}
|
||||||
|
@ -1265,7 +1258,7 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa)
|
||||||
test_log(test, "prepare: switch address-family to [%s]",
|
test_log(test, "prepare: switch address-family to [%s]",
|
||||||
get_afi_safi_str(pa->afi, pa->safi, false));
|
get_afi_safi_str(pa->afi, pa->safi, false));
|
||||||
test_execute(test, "address-family %s %s",
|
test_execute(test, "address-family %s %s",
|
||||||
str_from_afi(pa->afi), str_from_safi(pa->safi));
|
str_from_afi(pa->afi), safi2str(pa->safi));
|
||||||
test_execute(test, "neighbor %s activate", g->name);
|
test_execute(test, "neighbor %s activate", g->name);
|
||||||
test_execute(test, "neighbor %s activate", p->host);
|
test_execute(test, "neighbor %s activate", p->host);
|
||||||
}
|
}
|
||||||
|
@ -1464,7 +1457,7 @@ int main(void)
|
||||||
if (pa->afi && pa->safi)
|
if (pa->afi && pa->safi)
|
||||||
desc = asprintfrr(MTYPE_TMP, "peer\\%s-%s\\%s",
|
desc = asprintfrr(MTYPE_TMP, "peer\\%s-%s\\%s",
|
||||||
str_from_afi(pa->afi),
|
str_from_afi(pa->afi),
|
||||||
str_from_safi(pa->safi), pa->cmd);
|
safi2str(pa->safi), pa->cmd);
|
||||||
else
|
else
|
||||||
desc = asprintfrr(MTYPE_TMP, "peer\\%s", pa->cmd);
|
desc = asprintfrr(MTYPE_TMP, "peer\\%s", pa->cmd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue