Commit d3a5f691 authored by Michael Tremer's avatar Michael Tremer

network-list: Add more networks to test

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent 3e8d86ab
......@@ -72,6 +72,20 @@ int main(int argc, char** argv) {
exit(EXIT_FAILURE);
}
struct loc_network* subnet5;
err = loc_network_new_from_string(ctx, &subnet5, "2001:db8:e::/48");
if (err) {
fprintf(stderr, "Could not create the subnet5\n");
exit(EXIT_FAILURE);
}
struct loc_network* subnet6;
err = loc_network_new_from_string(ctx, &subnet6, "2001:db8:1::/48");
if (err) {
fprintf(stderr, "Could not create the subnet6\n");
exit(EXIT_FAILURE);
}
// Make a list with both subnets
struct loc_network_list* subnets;
err = loc_network_list_new(ctx, &subnets);
......@@ -117,10 +131,23 @@ int main(int argc, char** argv) {
exit(EXIT_FAILURE);
}
// Add more subnets
err = loc_network_list_push(subnets, subnet5);
if (err) {
fprintf(stderr, "Could not add subnet5 to subnets list\n");
exit(EXIT_FAILURE);
}
err = loc_network_list_push(subnets, subnet6);
if (err) {
fprintf(stderr, "Could not add subnet6 to subnets list\n");
exit(EXIT_FAILURE);
}
loc_network_list_dump(subnets);
size = loc_network_list_size(subnets);
if (size != 4) {
if (size != 6) {
fprintf(stderr, "Network list is reporting an incorrect size: %zu\n", size);
exit(EXIT_FAILURE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment