diff options
author | Edward Thomson <ethomson@microsoft.com> | 2013-08-28 04:41:44 +0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2013-08-28 04:44:35 +0400 |
commit | 1ff3a094156baba11240f48924dd5e0c1d983d8e (patch) | |
tree | 672fe40fc75b80061040489260d712104c59a0c5 /tests-clar/core | |
parent | ba7cc8d2f714875736a3c6f5e9cc720170a2166e (diff) |
Improve win32 version check, no ipv6 tests on XP
Diffstat (limited to 'tests-clar/core')
-rw-r--r-- | tests-clar/core/posix.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests-clar/core/posix.c b/tests-clar/core/posix.c index 890e25d47..1cef937cd 100644 --- a/tests-clar/core/posix.c +++ b/tests-clar/core/posix.c @@ -24,6 +24,16 @@ void test_core_posix__initialize(void) #endif } +static bool supports_ipv6(void) +{ +#ifdef GIT_WIN32 + /* IPv6 is supported on Vista and newer */ + return git_has_win32_version(6, 0, 0); +#else + return 1; +#endif +} + void test_core_posix__inet_pton(void) { struct in_addr addr; @@ -65,9 +75,12 @@ void test_core_posix__inet_pton(void) } /* Test some ipv6 addresses */ - for (i = 0; i < 6; i++) { - cl_assert(p_inet_pton(AF_INET6, in6_addr_data[i].p, &addr6) == 1); - cl_assert(memcmp(&addr6, in6_addr_data[i].n, sizeof(struct in6_addr)) == 0); + if (supports_ipv6()) + { + for (i = 0; i < 6; i++) { + cl_assert(p_inet_pton(AF_INET6, in6_addr_data[i].p, &addr6) == 1); + cl_assert(memcmp(&addr6, in6_addr_data[i].n, sizeof(struct in6_addr)) == 0); + } } /* Test some invalid strings */ |