+ // Make subnets
+ struct loc_network* subnet1 = NULL;
+ struct loc_network* subnet2 = NULL;
+
+ err = loc_network_subnets(network1, &subnet1, &subnet2);
+ if (err || !subnet1 || !subnet2) {
+ fprintf(stderr, "Could not find subnets of network: %d\n", err);
+ exit(EXIT_FAILURE);
+ }
+
+ const char* s = loc_network_str(subnet1);
+ printf("Received subnet1 = %s\n", s);
+
+ s = loc_network_str(subnet2);
+ printf("Received subnet2 = %s\n", s);
+
+ if (!loc_network_is_subnet(network1, subnet1)) {
+ fprintf(stderr, "Subnet1 is not a subnet\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (!loc_network_is_subnet(network1, subnet2)) {
+ fprintf(stderr, "Subnet2 is not a subnet\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (!loc_network_overlaps(network1, subnet1)) {
+ fprintf(stderr, "Network1 does not seem to contain subnet1\n");
+ exit(EXIT_FAILURE);
+ }
+
+ if (!loc_network_overlaps(network1, subnet2)) {
+ fprintf(stderr, "Network1 does not seem to contain subnet2\n");
+ exit(EXIT_FAILURE);
+ }
+
+ loc_network_unref(subnet1);
+ loc_network_unref(subnet2);
+
+ struct loc_network_list* excluded = loc_network_exclude(network1, network2);
+ if (!excluded) {
+ fprintf(stderr, "Could not create excluded list\n");
+ exit(EXIT_FAILURE);
+ }
+
+ loc_network_list_dump(excluded);
+ loc_network_list_unref(excluded);
+