26{
27
30 char buffer[100], buffer1[100];
36 float res1= -82.6267f, res2= 27.76f, res11, res12;
37 double double_res;
38 static const char pname[]=
" St. Petersburg, Florida\n";
39 int hour=21,
min=59,sec=20;
42
45
46
50
51
52 ok( p_sscanf(
"000000000046F170",
"%p", &
ptr) == 1,
"sscanf failed\n" );
53 ok(
ptr == (
void *)0x46F170,
"sscanf reads %p instead of %x\n",
ptr, 0x46F170 );
54
55 ok( p_sscanf(
"0046F171",
"%p", &
ptr) == 1,
"sscanf failed\n" );
56 ok(
ptr == (
void *)0x46F171,
"sscanf reads %p instead of %x\n",
ptr, 0x46F171 );
57
58 ok( p_sscanf(
"46F172",
"%p", &
ptr) == 1,
"sscanf failed\n" );
59 ok(
ptr == (
void *)0x46F172,
"sscanf reads %p instead of %x\n",
ptr, 0x46F172 );
60
61 ok( p_sscanf(
"0x46F173",
"%p", &
ptr) == 1,
"sscanf failed\n" );
62 ok(
ptr ==
NULL,
"sscanf reads %p instead of %x\n",
ptr, 0 );
63
64 ok( p_sscanf(
"-46F174",
"%p", &
ptr) == 1,
"sscanf failed\n" );
65 ok(
ptr == (
void *)(
ULONG_PTR)-0x46f174,
"sscanf reads %p instead of %p\n",
67
68 ok( p_sscanf(
"+46F175",
"%p", &
ptr) == 1,
"sscanf failed\n" );
69 ok(
ptr == (
void *)0x46F175,
"sscanf reads %p instead of %x\n",
ptr, 0x46F175 );
70
71
72 ok( p_sscanf(
"1233",
"%p", &
ptr) == 1,
"sscanf failed\n" );
73 ok(
ptr == (
void *)0x1233,
"sscanf reads %p instead of %x\n",
ptr, 0x1233 );
74
75 ok( p_sscanf(
"1234",
"%P", &
ptr) == 1,
"sscanf failed\n" );
76 ok(
ptr == (
void *)0x1234,
"sscanf reads %p instead of %x\n",
ptr, 0x1234 );
77
78
81 ok(
result == 0x519,
"sscanf reads %x instead of %x\n",
result, 0x519 );
82
85 ok(
result == 0x51a ,
"sscanf reads %x instead of %x\n",
result, 0x51a );
86
89 ok(
result == 0x51,
"sscanf reads %x instead of %x\n",
result, 0x51 );
90
93 ok(
ret == 1,
"Wrong number of arguments read: %d (expected 1)\n",
ret);
95
96
100 ok(
result == 12,
"sscanf reads %x instead of %x\n",
result, 12 );
101
102
103 ret = p_sprintf(
buffer,
"%f %f",res1, res2);
104 ok(
ret == 20,
"expected 20, got %u\n",
ret);
105 ret = p_sscanf(
buffer,
"%f%f",&res11, &res12);
106 ok(
ret == 2,
"expected 2, got %u\n",
ret);
107 ok( (res11 == res1) && (res12 == res2),
"Error reading floats\n");
108
109
111 ok(
ret == 9,
"expected 9, got %u\n",
ret);
112 ret = p_sscanf(
buffer,
"%lf", &double_res);
113 ok(
ret == 1,
"expected 1, got %u\n",
ret);
114 ok(double_res == 32.715,
"Got %lf, expected %lf\n", double_res, 32.715);
115 ret = p_sscanf(
buffer,
"%Lf", &double_res);
116 ok(
ret == 1,
"expected 1, got %u\n",
ret);
117 ok(double_res == 32.715,
"Got %lf, expected %lf\n", double_res, 32.715);
118
120 ret = p_sscanf(
buffer,
"%lf", &double_res);
121 ok(
ret == 1,
"expected 1, got %u\n",
ret);
122 ok(double_res >= 1.1e-30-1
e-45 && double_res <= 1.1e-30+1
e-45,
123 "Got %.18le, expected %.18le\n", double_res, 1.1e-30);
124
125
127 ok(
ret == 26,
"expected 26, got %u\n",
ret);
128 ret = p_sscanf(
buffer,
"%*c%[^\n]",buffer1);
129 ok(
ret == 1,
"Error with format \"%s\"\n",
"%*c%[^\n]");
131
132 ret = p_sscanf(
"abcefgdh",
"%*[a-cg-e]%c",&
buffer[0]);
133 ok(
ret == 1,
"Error with format \"%s\"\n",
"%*[a-cg-e]%c");
134 ok(
buffer[0] ==
'd',
"Error with \"abcefgdh\" \"%c\"\n",
buffer[0]);
135
136 ret = p_sscanf(
"abcefgdh",
"%*[a-cd-dg-e]%c",&
buffer[0]);
137 ok(
ret == 1,
"Error with format \"%s\"\n",
"%*[a-cd-dg-e]%c");
138 ok(
buffer[0] ==
'h',
"Error with \"abcefgdh\" \"%c\"\n",
buffer[0]);
139
140 buffer1[0] = 'b';
141 ret = p_sscanf(
"a",
"%s%s",
buffer, buffer1);
142 ok(
ret == 1,
"expected 1, got %u\n",
ret);
145 ok( buffer1[0] ==
'b',
"buffer1[0] = '%c'\n", buffer1[0]);
146
147
149 ok(
ret == 8,
"expected 8, got %u\n",
ret);
151 ok(
ret == 1 ,
"problem with format arg \"%%d%%n\"\n");
152 ok(
number == hour,
"Read wrong arg %d instead of %d\n",
number, hour);
153 ok(number_so_far == 2,
"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far);
154
155 ret = p_sscanf(
buffer+2,
"%*c%n",&number_so_far);
156 ok(
ret == 0 ,
"problem with format arg \"%%*c%%n\"\n");
157 ok(number_so_far == 1,
"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far);
158
162 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
164
167 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
169
171 ret = p_sscanf(
buffer,
"%lld", &result64);
172 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
173 ret = p_sprintf(buffer1,
"%lld", result64);
177
178
181 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
182 ok(
result == 123,
"Wrong number read\n");
185 ok(
ret == 1,
"Wrong number of arguments read: %d (expected 1)\n",
ret);
188 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
189 ok(
result == 123,
"Wrong number read\n");
192 ok(
ret == 1,
"Wrong number of arguments read: %d (expected 1)\n",
ret);
194
195
199 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
200 ok(
result == 15,
"Wrong number read\n");
204 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
205 ok(
result == 23,
"Wrong number read\n");
206
207
210 ok(
ret == 1,
"Wrong number of arguments read: %d (expected 1)\n",
ret);
212
213
216 ok(
ret == 1,
"Wrong number of arguments read: %d (expected 1)\n",
ret);
218
219
223 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
224 ok(
c ==
'a',
"Field incorrect: '%c'\n",
c);
225
229 ok(
ret == 1,
"Wrong number of arguments read: %d\n",
ret);
230 ok(
c ==
' ',
"Field incorrect: '%c'\n",
c);
231
235 ok(
ret == 2,
"Wrong number of arguments read: %d\n",
ret);
236 ok(hour == 18,
"Field 1 incorrect: %d\n", hour);
237 ok(
min == 59,
"Field 2 incorrect: %d\n",
min);
238 ok(
c == 0x55,
"Field 3 incorrect: 0x%02x\n",
c);
239
240
241 buffer[0]=0; buffer1[0]=0;
242 ret = p_sscanf(
"abc def",
"%s %n%s",
buffer, &number_so_far, buffer1);
244 ok(
strcmp(buffer1,
"def")==0,
"Second %%s read incorrectly: %s\n", buffer1);
245 ok(number_so_far==6,
"%%n yielded wrong result: %d\n", number_so_far);
246 ok(
ret == 2,
"%%n shouldn't count as a conversion: %d\n",
ret);
247
248
250 ret = p_sscanf(
buffer,
"%d:%d%n", &hour, &
min, &number_so_far);
251 ok(
ret == 2,
"Wrong number of arguments read: %d\n",
ret);
252 ok(number_so_far == 4,
"%%n yielded wrong result: %d\n", number_so_far);
253
255 buffer1[0] = 0;
256 ret = p_sscanf(
"test=value\xda",
"%[^=] = %[^;]",
buffer, buffer1);
259 ok(!
strcmp(buffer1,
"value\xda"),
"buf %s\n", buffer1);
260
261 ret = p_sscanf(
"\x81\x82test",
"\x81%\x82%s",
buffer);
264}
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
#define GetProcAddress(x, y)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
static PEXPLICIT_ACCESSW *static HMODULE hmod
static unsigned int number