Annotation of embedaddon/miniupnpc/src/testaddr_is_reserved.c, revision 1.1
1.1 ! misho 1: /* $Id: testaddr_is_reserved.c,v 1.1 2020/10/15 22:12:51 nanard Exp $ */
! 2: /* vim: tabstop=4 shiftwidth=4 noexpandtab
! 3: * Project : miniupnp
! 4: * Web : http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
! 5: * Author : Thomas BERNARD
! 6: * copyright (c) 2005-2020 Thomas Bernard
! 7: * This software is subjet to the conditions detailed in the
! 8: * provided LICENSE file. */
! 9: #include <stdio.h>
! 10: #include "addr_is_reserved.h"
! 11:
! 12: static const struct {
! 13: const char * str;
! 14: int expected_result;
! 15: } tests[] = {
! 16: { "0.0.0.0", 1 },
! 17: { "8.8.8.8", 0 },
! 18: { "192.168.1.1", 1 },
! 19: { "10.250.42.12", 1 },
! 20: { "11.250.42.12", 0 },
! 21: { "172.31.1.1", 1 },
! 22: { "172.32.1.1", 0 },
! 23: { "169.254.42.42", 1 },
! 24: { "192.0.0.11", 1 },
! 25: { "198.0.0.11", 0 },
! 26: { "198.18.0.11", 1 },
! 27: { "100.64.1.1", 1 },
! 28: { "100.127.1.1", 1 },
! 29: { "100.128.1.1", 0 },
! 30: { NULL, 0 }
! 31: };
! 32:
! 33: int main(int argc, char * * argv) {
! 34: int i, result;
! 35: (void)argc; (void)argv;
! 36:
! 37: for (i = 0; tests[i].str != NULL; i++) {
! 38: result = addr_is_reserved(tests[i].str);
! 39: printf("testing %s %d %d\n", tests[i].str, tests[i].expected_result, result);
! 40: if (result != tests[i].expected_result) {
! 41: fprintf(stderr, "*** FAILURE ***\n");
! 42: return 1; /* Failure */
! 43: }
! 44: }
! 45: return 0; /* success */
! 46: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>