Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7d78bf4b
Commit
7d78bf4b
authored
Apr 27, 2009
by
Jeff Latimer
Committed by
Alexandre Julliard
Apr 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: IPv6 tests for WSAAddressToStringA.
parent
9f6bd09e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
0 deletions
+105
-0
sock.c
dlls/ws2_32/tests/sock.c
+105
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
7d78bf4b
...
...
@@ -1272,6 +1272,7 @@ static void test_WSASocket(void)
static
void
test_WSAAddressToStringA
(
void
)
{
SOCKET
v6
=
INVALID_SOCKET
;
INT
ret
;
DWORD
len
;
int
GLE
;
...
...
@@ -1283,6 +1284,19 @@ static void test_WSAAddressToStringA(void)
CHAR
expect3
[]
=
"0.0.0.0:65535"
;
CHAR
expect4
[]
=
"255.255.255.255:65535"
;
SOCKADDR_IN6
sockaddr6
;
CHAR
address6
[
54
];
/* 32 digits + 7':' + '[' + '%" + 5 digits + ']:' + 5 digits + '\0' */
CHAR
addr6_1
[]
=
{
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
};
CHAR
addr6_2
[]
=
{
0x20
,
0xab
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x01
};
CHAR
addr6_3
[]
=
{
0x20
,
0xab
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x20
,
0x01
};
CHAR
expect6_1
[]
=
"::1"
;
CHAR
expect6_2
[]
=
"20ab::1"
;
CHAR
expect6_3
[]
=
"[20ab::2001]:33274"
;
CHAR
expect6_3_2
[]
=
"[20ab::2001%4660]:33274"
;
CHAR
expect6_3_3
[]
=
"20ab::2001%4660"
;
len
=
0
;
sockaddr
.
sin_family
=
AF_INET
;
...
...
@@ -1340,6 +1354,97 @@ static void test_WSAAddressToStringA(void)
ok
(
!
strcmp
(
address
,
expect4
),
"Expected: %s, got: %s
\n
"
,
expect4
,
address
);
ok
(
len
==
sizeof
(
expect4
),
"Got size %d
\n
"
,
len
);
/*check to see it IPv6 is available */
v6
=
socket
(
AF_INET6
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
v6
==
INVALID_SOCKET
)
{
skip
(
"Could not create IPv6 socket (LastError: %d; %d expected if IPv6 not available).
\n
"
,
WSAGetLastError
(),
WSAEAFNOSUPPORT
);
goto
end
;
}
/* Test a short IPv6 address */
len
=
sizeof
(
address6
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0x0000
;
sockaddr6
.
sin6_scope_id
=
0
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_1
,
sizeof
(
addr6_1
));
ret
=
WSAAddressToStringA
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringA() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
strcmp
(
address6
,
expect6_1
),
"Expected: %s, got: %s
\n
"
,
expect6_1
,
address6
);
ok
(
len
==
sizeof
(
expect6_1
),
"Got size %d
\n
"
,
len
);
}
/* Test a longer IPv6 address */
len
=
sizeof
(
address6
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0x0000
;
sockaddr6
.
sin6_scope_id
=
0
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_2
,
sizeof
(
addr6_2
));
ret
=
WSAAddressToStringA
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringA() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
strcmp
(
address6
,
expect6_2
),
"Expected: %s, got: %s
\n
"
,
expect6_2
,
address6
);
ok
(
len
==
sizeof
(
expect6_2
),
"Got size %d
\n
"
,
len
);
}
/* Test IPv6 address and port number */
len
=
sizeof
(
address6
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0xfa81
;
sockaddr6
.
sin6_scope_id
=
0
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_3
,
sizeof
(
addr6_3
));
ret
=
WSAAddressToStringA
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringA() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
strcmp
(
address6
,
expect6_3
),
"Expected: %s, got: %s
\n
"
,
expect6_3
,
address6
);
ok
(
len
==
sizeof
(
expect6_3
),
"Got size %d
\n
"
,
len
);
}
/* Test IPv6 address, port number and scope_id */
len
=
sizeof
(
address6
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0xfa81
;
sockaddr6
.
sin6_scope_id
=
0x1234
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_3
,
sizeof
(
addr6_3
));
ret
=
WSAAddressToStringA
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringA() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
strcmp
(
address6
,
expect6_3_2
),
"Expected: %s, got: %s
\n
"
,
expect6_3_2
,
address6
);
ok
(
len
==
sizeof
(
expect6_3_2
),
"Got size %d
\n
"
,
len
);
}
/* Test IPv6 address and scope_id */
len
=
sizeof
(
address6
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0x0000
;
sockaddr6
.
sin6_scope_id
=
0x1234
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_3
,
sizeof
(
addr6_3
));
ret
=
WSAAddressToStringA
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringA() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
strcmp
(
address6
,
expect6_3_3
),
"Expected: %s, got: %s
\n
"
,
expect6_3_3
,
address6
);
ok
(
len
==
sizeof
(
expect6_3_3
),
"Got size %d
\n
"
,
len
);
}
end:
if
(
v6
!=
INVALID_SOCKET
)
closesocket
(
v6
);
}
static
void
test_WSAAddressToStringW
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment