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
14f41641
Commit
14f41641
authored
Nov 06, 2014
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add UTF-7 stray + sign removal tests.
parent
5d43ef68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
codepage.c
dlls/kernel32/tests/codepage.c
+68
-0
No files found.
dlls/kernel32/tests/codepage.c
View file @
14f41641
...
...
@@ -527,6 +527,73 @@ static void test_utf7_encoding(void)
}
}
static
void
test_utf7_decoding
(
void
)
{
char
input
[
32
];
WCHAR
output
[
32
],
expected
[
32
];
int
i
,
len
,
expected_len
;
static
const
signed
char
base64_decoding_table
[]
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* 0x00-0x0F */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* 0x10-0x1F */
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
62
,
-
1
,
-
1
,
-
1
,
63
,
/* 0x20-0x2F */
52
,
53
,
54
,
55
,
56
,
57
,
58
,
59
,
60
,
61
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* 0x30-0x3F */
-
1
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
,
14
,
/* 0x40-0x4F */
15
,
16
,
17
,
18
,
19
,
20
,
21
,
22
,
23
,
24
,
25
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
/* 0x50-0x5F */
-
1
,
26
,
27
,
28
,
29
,
30
,
31
,
32
,
33
,
34
,
35
,
36
,
37
,
38
,
39
,
40
,
/* 0x60-0x6F */
41
,
42
,
43
,
44
,
45
,
46
,
47
,
48
,
49
,
50
,
51
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
/* 0x70-0x7F */
};
if
(
MultiByteToWideChar
(
CP_UTF7
,
0
,
"foobar"
,
-
1
,
NULL
,
0
)
==
0
&&
GetLastError
()
==
ERROR_CALL_NOT_IMPLEMENTED
)
{
skip
(
"UTF-7 decoding not implemented
\n
"
);
return
;
}
/* test which one-byte characters remove stray + signs */
for
(
i
=
0
;
i
<
256
;
i
++
)
{
sprintf
(
input
,
"+%c+AAA"
,
i
);
memset
(
output
,
0x23
,
sizeof
(
output
)
-
sizeof
(
WCHAR
));
output
[
sizeof
(
output
)
/
sizeof
(
WCHAR
)
-
1
]
=
0
;
len
=
MultiByteToWideChar
(
CP_UTF7
,
0
,
input
,
7
,
output
,
sizeof
(
output
)
/
sizeof
(
WCHAR
)
-
1
);
if
(
i
==
'-'
)
{
/* removes the - sign */
expected_len
=
3
;
expected
[
0
]
=
0x002B
;
expected
[
1
]
=
0
;
expected
[
2
]
=
0
;
}
else
if
(
i
<=
0x7F
&&
base64_decoding_table
[
i
]
!=
-
1
)
{
/* absorbs the character into the base64 sequence */
expected_len
=
2
;
expected
[
0
]
=
(
base64_decoding_table
[
i
]
<<
10
)
|
0x03E0
;
expected
[
1
]
=
0
;
}
else
{
/* removes the + sign */
expected_len
=
3
;
expected
[
0
]
=
i
;
expected
[
1
]
=
0
;
expected
[
2
]
=
0
;
}
expected
[
expected_len
]
=
0x2323
;
ok
(
len
==
expected_len
,
"i=0x%02x: expected len=%i, got len=%i
\n
"
,
i
,
expected_len
,
len
);
ok
(
memcmp
(
output
,
expected
,
(
expected_len
+
1
)
*
sizeof
(
WCHAR
))
==
0
,
"i=0x%02x: expected output=%s, got output=%s
\n
"
,
i
,
wine_dbgstr_wn
(
expected
,
expected_len
+
1
),
wine_dbgstr_wn
(
output
,
expected_len
+
1
));
}
}
static
void
test_undefined_byte_char
(
void
)
{
static
const
struct
tag_testset
{
...
...
@@ -734,6 +801,7 @@ START_TEST(codepage)
test_string_conversion
(
&
bUsedDefaultChar
);
test_utf7_encoding
();
test_utf7_decoding
();
test_undefined_byte_char
();
test_threadcp
();
...
...
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