ReactOS 0.4.15-dev-7842-g558ab78
CheckEscapes.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for CheckEscapesA/W
5 * PROGRAMMER: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7#include "shelltest.h"
8
11
14
15typedef struct TESTENTRYA
16{
22
23typedef struct TESTENTRYW
24{
30
31static const TESTENTRYA s_entriesA[] =
32{
33 { __LINE__, "", 0, "" },
34 { __LINE__, "", 1, "" },
35 { __LINE__, "", 2, "" },
36 { __LINE__, "", 3, "" },
37 { __LINE__, "", 4, "" },
38 { __LINE__, "", 5, "" },
39 { __LINE__, "", 6, "" },
40 { __LINE__, "ABC", 1, "" },
41 { __LINE__, "ABC", 2, "A" },
42 { __LINE__, "ABC", 3, "AB" },
43 { __LINE__, "ABC", 4, "ABC" },
44 { __LINE__, "ABC", 5, "ABC" },
45 { __LINE__, "ABC", 6, "ABC" },
46 { __LINE__, "AB C", 1, "" },
47 { __LINE__, "AB C", 2, "A" },
48 { __LINE__, "AB C", 3, "AB" },
49 { __LINE__, "AB C", 4, "AB " },
50 { __LINE__, "AB C", 5, "AB C" },
51 { __LINE__, "AB C", 6, "\"AB C" },
52 { __LINE__, "AB C ", 1, "" },
53 { __LINE__, "AB C ", 2, "A" },
54 { __LINE__, "AB C ", 3, "AB" },
55 { __LINE__, "AB C ", 4, "AB " },
56 { __LINE__, "AB C ", 5, "AB C" },
57 { __LINE__, "AB C ", 6, "AB C " },
58 { __LINE__, "AB,", 1, "" },
59 { __LINE__, "AB,", 2, "A" },
60 { __LINE__, "AB,", 3, "AB" },
61 { __LINE__, "AB,", 4, "AB," },
62 { __LINE__, "AB,", 5, "\"AB," },
63 { __LINE__, "AB,", 6, "\"AB,\"" },
64 { __LINE__, "AB\"", 1, "" },
65 { __LINE__, "AB\"", 2, "A" },
66 { __LINE__, "AB\"", 3, "AB" },
67 { __LINE__, "AB\"", 4, "AB\"" },
68 { __LINE__, "AB\"", 5, "\"AB\"" },
69 { __LINE__, "AB\"", 6, "\"AB\"\"" },
70 { __LINE__, "AB;", 1, "" },
71 { __LINE__, "AB;", 2, "A" },
72 { __LINE__, "AB;", 3, "AB" },
73 { __LINE__, "AB;", 4, "AB;" },
74 { __LINE__, "AB;", 5, "\"AB;" },
75 { __LINE__, "AB;", 6, "\"AB;\"" },
76 { __LINE__, "AB^", 1, "" },
77 { __LINE__, "AB^", 2, "A" },
78 { __LINE__, "AB^", 3, "AB" },
79 { __LINE__, "AB^", 4, "AB^" },
80 { __LINE__, "AB^", 5, "\"AB^" },
81 { __LINE__, "AB^", 6, "\"AB^\"" },
82};
83
84static const TESTENTRYW s_entriesW[] =
85{
86 { __LINE__, L"", 0, L"" },
87 { __LINE__, L"", 1, L"" },
88 { __LINE__, L"", 2, L"" },
89 { __LINE__, L"", 3, L"" },
90 { __LINE__, L"", 4, L"" },
91 { __LINE__, L"", 5, L"" },
92 { __LINE__, L"", 6, L"" },
93 { __LINE__, L"ABC", 1, L"ABC" },
94 { __LINE__, L"ABC", 2, L"ABC" },
95 { __LINE__, L"ABC", 3, L"ABC" },
96 { __LINE__, L"ABC", 4, L"ABC" },
97 { __LINE__, L"ABC", 5, L"ABC" },
98 { __LINE__, L"ABC", 6, L"ABC" },
99 { __LINE__, L"AB C", 1, L"AB C" },
100 { __LINE__, L"AB C", 2, L"AB C" },
101 { __LINE__, L"AB C", 3, L"AB C" },
102 { __LINE__, L"AB C", 4, L"AB C" },
103 { __LINE__, L"AB C", 5, L"AB C" },
104 { __LINE__, L"AB C", 6, L"\"AB C\"" },
105 { __LINE__, L"AB C ", 1, L"AB C " },
106 { __LINE__, L"AB C ", 2, L"AB C " },
107 { __LINE__, L"AB C ", 3, L"AB C " },
108 { __LINE__, L"AB C ", 4, L"AB C " },
109 { __LINE__, L"AB C ", 5, L"AB C " },
110 { __LINE__, L"AB C ", 6, L"AB C " },
111 { __LINE__, L"AB,", 1, L"AB," },
112 { __LINE__, L"AB,", 2, L"AB," },
113 { __LINE__, L"AB,", 3, L"AB," },
114 { __LINE__, L"AB,", 4, L"AB," },
115 { __LINE__, L"AB,", 5, L"\"AB,\"" },
116 { __LINE__, L"AB,", 6, L"\"AB,\"" },
117 { __LINE__, L"AB\"", 1, L"AB\"" },
118 { __LINE__, L"AB\"", 2, L"AB\"" },
119 { __LINE__, L"AB\"", 3, L"AB\"" },
120 { __LINE__, L"AB\"", 4, L"AB\"" },
121 { __LINE__, L"AB\"", 5, L"\"AB\"\"" },
122 { __LINE__, L"AB\"", 6, L"\"AB\"\"" },
123 { __LINE__, L"AB;", 1, L"AB;" },
124 { __LINE__, L"AB;", 2, L"AB;" },
125 { __LINE__, L"AB;", 3, L"AB;" },
126 { __LINE__, L"AB;", 4, L"AB;" },
127 { __LINE__, L"AB;", 5, L"\"AB;\"" },
128 { __LINE__, L"AB;", 6, L"\"AB;\"" },
129 { __LINE__, L"AB^", 1, L"AB^" },
130 { __LINE__, L"AB^", 2, L"AB^" },
131 { __LINE__, L"AB^", 3, L"AB^" },
132 { __LINE__, L"AB^", 4, L"AB^" },
133 { __LINE__, L"AB^", 5, L"\"AB^\"" },
134 { __LINE__, L"AB^", 6, L"\"AB^\"" },
135};
136
137static void JustDoIt(void)
138{
139 SIZE_T i, count;
140 CHAR bufA[MAX_PATH];
141 WCHAR bufW[MAX_PATH];
142
144 for (i = 0; i < count; ++i)
145 {
146 lstrcpynA(bufA, s_entriesA[i].input, _countof(bufA));
148 ok(lstrcmpA(bufA, s_entriesA[i].output) == 0,
149 "Line %d: output expected '%s' vs got '%s'\n",
150 s_entriesA[i].lineno, s_entriesA[i].output, bufA);
151 }
152
154 for (i = 0; i < count; ++i)
155 {
156 lstrcpynW(bufW, s_entriesW[i].input, _countof(bufW));
158 ok(lstrcmpW(bufW, s_entriesW[i].output) == 0,
159 "Line %d: output expected '%ls' vs got '%ls'\n",
160 s_entriesW[i].lineno, s_entriesW[i].output, bufW);
161 }
162}
163
164START_TEST(CheckEscapes)
165{
170 {
171 JustDoIt();
172 }
173 else
174 {
175 skip("There is no CheckEscapesA/W\n");
176 }
177}
static void JustDoIt(void)
void(WINAPI * FN_CheckEscapesA)(LPSTR string, DWORD len)
Definition: CheckEscapes.cpp:9
void(WINAPI * FN_CheckEscapesW)(LPWSTR string, DWORD len)
static const TESTENTRYA s_entriesA[]
static FN_CheckEscapesA s_pCheckEscapesA
static const TESTENTRYW s_entriesW[]
static FN_CheckEscapesW s_pCheckEscapesW
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define lstrcpynA
Definition: compat.h:751
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
#define lstrcpynW
Definition: compat.h:738
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
GLenum GLenum GLenum input
Definition: glext.h:9031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
char string[160]
Definition: util.h:11
static HMODULE hShell32
Definition: string.c:34
#define L(x)
Definition: ntvdm.h:50
#define _countof(array)
Definition: sndvol32.h:68
LPCSTR output
LPCSTR input
LPCWSTR output
LPCWSTR input
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define WINAPI
Definition: msvc.h:6
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175