Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
c620ec8f
Commit
c620ec8f
authored
Jul 17, 2009
by
Jeff Latimer
Committed by
Alexandre Julliard
Jul 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: IPv6 tests for WSAAddressToStringW.
parent
cb7c72f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
1 deletion
+111
-1
sock.c
dlls/ws2_32/tests/sock.c
+111
-1
No files found.
dlls/ws2_32/tests/sock.c
View file @
c620ec8f
...
...
@@ -1474,6 +1474,7 @@ end:
static
void
test_WSAAddressToStringW
(
void
)
{
SOCKET
v6
=
INVALID_SOCKET
;
INT
ret
;
DWORD
len
;
int
GLE
;
...
...
@@ -1486,6 +1487,19 @@ static void test_WSAAddressToStringW(void)
WCHAR
expect4
[]
=
{
'2'
,
'5'
,
'5'
,
'.'
,
'2'
,
'5'
,
'5'
,
'.'
,
'2'
,
'5'
,
'5'
,
'.'
,
'2'
,
'5'
,
'5'
,
':'
,
'6'
,
'5'
,
'5'
,
'3'
,
'5'
,
0
};
SOCKADDR_IN6
sockaddr6
;
WCHAR
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
};
WCHAR
expect6_1
[]
=
{
':'
,
':'
,
'1'
,
0
};
WCHAR
expect6_2
[]
=
{
'2'
,
'0'
,
'a'
,
'b'
,
':'
,
':'
,
'1'
,
0
};
WCHAR
expect6_3
[]
=
{
'['
,
'2'
,
'0'
,
'a'
,
'b'
,
':'
,
':'
,
'2'
,
'0'
,
'0'
,
'1'
,
']'
,
':'
,
'3'
,
'3'
,
'2'
,
'7'
,
'4'
,
0
};
WCHAR
expect6_3_2
[]
=
{
'['
,
'2'
,
'0'
,
'a'
,
'b'
,
':'
,
':'
,
'2'
,
'0'
,
'0'
,
'1'
,
'%'
,
'4'
,
'6'
,
'6'
,
'0'
,
']'
,
':'
,
'3'
,
'3'
,
'2'
,
'7'
,
'4'
,
0
};
WCHAR
expect6_3_3
[]
=
{
'2'
,
'0'
,
'a'
,
'b'
,
':'
,
':'
,
'2'
,
'0'
,
'0'
,
'1'
,
'%'
,
'6'
,
'5'
,
'5'
,
'3'
,
'4'
,
0
};
len
=
0
;
sockaddr
.
sin_family
=
AF_INET
;
...
...
@@ -1542,7 +1556,103 @@ static void test_WSAAddressToStringW(void)
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address
,
expect4
),
"Expected different address string
\n
"
);
ok
(
len
==
sizeof
(
expect4
)
/
sizeof
(
WCHAR
),
"Got size %d
\n
"
,
len
);
ok
(
len
==
sizeof
(
expect4
)
/
sizeof
(
WCHAR
),
"Got %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
)
/
sizeof
(
WCHAR
);
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
=
WSAAddressToStringW
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address6
,
expect6_1
),
"Wrong string returned
\n
"
);
ok
(
len
==
sizeof
(
expect6_1
)
/
sizeof
(
WCHAR
),
"Got %d
\n
"
,
len
);
}
/* Test a longer IPv6 address */
len
=
sizeof
(
address6
)
/
sizeof
(
WCHAR
);
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
=
WSAAddressToStringW
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address6
,
expect6_2
),
"Wrong string returned
\n
"
);
ok
(
len
==
sizeof
(
expect6_2
)
/
sizeof
(
WCHAR
),
"Got %d
\n
"
,
len
);
}
/* Test IPv6 address and port number */
len
=
sizeof
(
address6
)
/
sizeof
(
WCHAR
);
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
=
WSAAddressToStringW
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address6
,
expect6_3
),
"Wrong string returned
\n
"
);
ok
(
len
==
sizeof
(
expect6_3
)
/
sizeof
(
WCHAR
),
"Got %d
\n
"
,
len
);
}
/* Test IPv6 address, port number and scope_id */
len
=
sizeof
(
address6
)
/
sizeof
(
WCHAR
);
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
=
WSAAddressToStringW
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address6
,
expect6_3_2
),
"Wrong string returned
\n
"
);
ok
(
len
==
sizeof
(
expect6_3_2
)
/
sizeof
(
WCHAR
),
"Got %d
\n
"
,
len
);
}
/* Test IPv6 address and scope_id */
len
=
sizeof
(
address6
)
/
sizeof
(
WCHAR
);
sockaddr6
.
sin6_family
=
AF_INET6
;
sockaddr6
.
sin6_port
=
0x0000
;
sockaddr6
.
sin6_scope_id
=
0xfffe
;
memcpy
(
sockaddr6
.
sin6_addr
.
s6_addr
,
addr6_3
,
sizeof
(
addr6_3
));
ret
=
WSAAddressToStringW
(
(
SOCKADDR
*
)
&
sockaddr6
,
sizeof
(
sockaddr6
),
NULL
,
address6
,
&
len
);
todo_wine
{
ok
(
!
ret
,
"WSAAddressToStringW() failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
ok
(
!
lstrcmpW
(
address6
,
expect6_3_3
),
"Wrong string returned
\n
"
);
ok
(
len
==
sizeof
(
expect6_3_3
)
/
sizeof
(
WCHAR
),
"Got %d
\n
"
,
len
);
}
end:
if
(
v6
!=
INVALID_SOCKET
)
closesocket
(
v6
);
}
static
void
test_WSAStringToAddressA
(
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