Lines Matching refs:buffer

105 	char buffer[400];  in ZTEST()  local
123 sprintf(buffer, "%e", var.d); in ZTEST()
124 zassert_true((strcmp(buffer, "inf") == 0), in ZTEST()
125 "sprintf(inf) - incorrect output '%s'\n", buffer); in ZTEST()
127 sprintf(buffer, "%E", var.d); in ZTEST()
128 zassert_true((strcmp(buffer, "INF") == 0), in ZTEST()
129 "sprintf(INF) - incorrect output '%s'\n", buffer); in ZTEST()
131 sprintf(buffer, "%f", var.d); in ZTEST()
132 zassert_true((strcmp(buffer, "inf") == 0), in ZTEST()
133 "sprintf(inf) - incorrect output '%s'\n", buffer); in ZTEST()
135 sprintf(buffer, "%F", var.d); in ZTEST()
136 zassert_true((strcmp(buffer, "INF") == 0), in ZTEST()
137 "sprintf(INF) - incorrect output '%s'\n", buffer); in ZTEST()
139 sprintf(buffer, "%g", var.d); in ZTEST()
140 zassert_true((strcmp(buffer, "inf") == 0), in ZTEST()
141 "sprintf(inf) - incorrect output '%s'\n", buffer); in ZTEST()
143 sprintf(buffer, "%G", var.d); in ZTEST()
144 zassert_true((strcmp(buffer, "INF") == 0), in ZTEST()
145 "sprintf(INF) - incorrect output '%s'\n", buffer); in ZTEST()
149 sprintf(buffer, "%e", var.d); in ZTEST()
150 zassert_true((strcmp(buffer, "-inf") == 0), in ZTEST()
151 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
153 sprintf(buffer, "%E", var.d); in ZTEST()
154 zassert_true((strcmp(buffer, "-INF") == 0), in ZTEST()
155 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
157 sprintf(buffer, "%f", var.d); in ZTEST()
158 zassert_true((strcmp(buffer, "-inf") == 0), in ZTEST()
159 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
161 sprintf(buffer, "%F", var.d); in ZTEST()
162 zassert_true((strcmp(buffer, "-INF") == 0), in ZTEST()
163 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
165 sprintf(buffer, "%g", var.d); in ZTEST()
166 zassert_true((strcmp(buffer, "-inf") == 0), in ZTEST()
167 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
169 sprintf(buffer, "%G", var.d); in ZTEST()
170 zassert_true((strcmp(buffer, "-INF") == 0), in ZTEST()
171 "sprintf(-INF) - incorrect output '%s'\n", buffer); in ZTEST()
173 sprintf(buffer, "%010f", var.d); in ZTEST()
174 zassert_true((strcmp(buffer, " -inf") == 0), in ZTEST()
175 "sprintf( +inf) - incorrect output '%s'\n", buffer); in ZTEST()
179 sprintf(buffer, "%e", var.d); in ZTEST()
180 zassert_true((strcmp(buffer, "nan") == 0), in ZTEST()
181 "sprintf(nan) - incorrect output '%s'\n", buffer); in ZTEST()
183 sprintf(buffer, "%E", var.d); in ZTEST()
184 zassert_true((strcmp(buffer, "NAN") == 0), in ZTEST()
185 "sprintf(NAN) - incorrect output '%s'\n", buffer); in ZTEST()
187 sprintf(buffer, "%f", var.d); in ZTEST()
188 zassert_true((strcmp(buffer, "nan") == 0), in ZTEST()
189 "sprintf(nan) - incorrect output '%s'\n", buffer); in ZTEST()
191 sprintf(buffer, "%F", var.d); in ZTEST()
192 zassert_true((strcmp(buffer, "NAN") == 0), in ZTEST()
193 "sprintf(NAN) - incorrect output '%s'\n", buffer); in ZTEST()
195 sprintf(buffer, "%g", var.d); in ZTEST()
196 zassert_true((strcmp(buffer, "nan") == 0), in ZTEST()
197 "sprintf(nan) - incorrect output '%s'\n", buffer); in ZTEST()
199 sprintf(buffer, "%G", var.d); in ZTEST()
200 zassert_true((strcmp(buffer, "NAN") == 0), in ZTEST()
201 "sprintf(NAN) - incorrect output '%s'\n", buffer); in ZTEST()
203 sprintf(buffer, "%+8.5e", var.d); in ZTEST()
204 zassert_true((strcmp(buffer, " +nan") == 0), in ZTEST()
205 "sprintf( +nan) - incorrect output '%s'\n", buffer); in ZTEST()
209 sprintf(buffer, "%e", var.d); in ZTEST()
210 zassert_true((strcmp(buffer, "-nan") == 0), in ZTEST()
211 "sprintf(-nan) - incorrect output '%s'\n", buffer); in ZTEST()
213 sprintf(buffer, "%E", var.d); in ZTEST()
214 zassert_true((strcmp(buffer, "-NAN") == 0), in ZTEST()
215 "sprintf(-NAN) - incorrect output '%s'\n", buffer); in ZTEST()
217 sprintf(buffer, "%f", var.d); in ZTEST()
218 zassert_true((strcmp(buffer, "-nan") == 0), in ZTEST()
219 "sprintf(-nan) - incorrect output '%s'\n", buffer); in ZTEST()
221 sprintf(buffer, "%F", var.d); in ZTEST()
222 zassert_true((strcmp(buffer, "-NAN") == 0), in ZTEST()
223 "sprintf(-NAN) - incorrect output '%s'\n", buffer); in ZTEST()
225 sprintf(buffer, "%g", var.d); in ZTEST()
226 zassert_true((strcmp(buffer, "-nan") == 0), in ZTEST()
227 "sprintf(-nan) - incorrect output '%s'\n", buffer); in ZTEST()
229 sprintf(buffer, "%G", var.d); in ZTEST()
230 zassert_true((strcmp(buffer, "-NAN") == 0), in ZTEST()
231 "sprintf(-NAN) - incorrect output '%s'\n", buffer); in ZTEST()
234 sprintf(buffer, "%f", var.d); in ZTEST()
235 zassert_true((strcmp(buffer, "1.000000") == 0), in ZTEST()
236 "sprintf(1.0) - incorrect output '%s'\n", buffer); in ZTEST()
238 sprintf(buffer, "%+f", var.d); in ZTEST()
239 zassert_true((strcmp(buffer, "+1.000000") == 0), in ZTEST()
240 "sprintf(+1.0) - incorrect output '%s'\n", buffer); in ZTEST()
242 sprintf(buffer, "%.2f", var.d); in ZTEST()
243 zassert_true((strcmp(buffer, "1.00") == 0), in ZTEST()
244 "sprintf(1.00) - incorrect output '%s'\n", buffer); in ZTEST()
246 sprintf(buffer, "%.*f", 11, var.d); in ZTEST()
247 zassert_true((strcmp(buffer, "1.00000000000") == 0), in ZTEST()
249 "output '%s'\n", buffer); in ZTEST()
251 sprintf(buffer, "%12f", var.d); in ZTEST()
252 zassert_true((strcmp(buffer, " 1.000000") == 0), in ZTEST()
254 "output '%s'\n", buffer); in ZTEST()
256 sprintf(buffer, "%-12f", var.d); in ZTEST()
257 zassert_true((strcmp(buffer, "1.000000 ") == 0), in ZTEST()
259 "output '%s'\n", buffer); in ZTEST()
261 sprintf(buffer, "%012f", var.d); in ZTEST()
262 zassert_true((strcmp(buffer, "00001.000000") == 0), in ZTEST()
264 "output '%s'\n", buffer); in ZTEST()
267 sprintf(buffer, "%f", var.d); in ZTEST()
268 zassert_true((strcmp(buffer, "-1.000000") == 0), in ZTEST()
269 "sprintf(-1.0) - incorrect output '%s'\n", buffer); in ZTEST()
272 sprintf(buffer, "%f", var.d); in ZTEST()
273 zassert_true((strcmp(buffer, "1234.567890") == 0), in ZTEST()
274 "sprintf(1234.56789) - incorrect output '%s'\n", buffer); in ZTEST()
283 sprintf(buffer, "%.140f", var.d); in ZTEST()
284 zassert_true((strlen(buffer) == 382), in ZTEST()
286 strlen(buffer)); in ZTEST()
287 buffer[10] = 0; /* log facility doesn't support %.10s */ in ZTEST()
288 zassert_true((strcmp(buffer, "6668014432") == 0), in ZTEST()
290 "expected \"6668014432\"\n", buffer); in ZTEST()
291 zassert_true((buffer[241] == '.'), in ZTEST()
293 buffer[241]); in ZTEST()
298 sprintf(buffer, "% .380f", var.d); in ZTEST()
299 zassert_true((strlen(buffer) == 383), in ZTEST()
301 strlen(buffer)); in ZTEST()
302 zassert_equal(strncmp(&buffer[119], "00003872", 8), 0, in ZTEST()
304 buffer[10] = 0; /* log facility doesn't support %.10s */ in ZTEST()
305 zassert_true((strcmp(buffer, " 0.0000000") == 0), in ZTEST()
307 "expected \" 0.0000000\"\n", buffer); in ZTEST()
308 buffer[119 + 10] = 0; /* log facility doesn't support %.10s */ in ZTEST()
309 zassert_true((strcmp(buffer + 119, "0000387259") == 0), in ZTEST()
311 "while expecting \"0000387259\"\n", buffer + 119); in ZTEST()
315 sprintf(buffer, "%e", var.d); in ZTEST()
316 zassert_true((strcmp(buffer, "1.234000e+03") == 0), in ZTEST()
318 "output '%s'\n", buffer); in ZTEST()
320 sprintf(buffer, "%E", var.d); in ZTEST()
321 zassert_true((strcmp(buffer, "1.234000E+03") == 0), in ZTEST()
323 "output '%s'\n", buffer); in ZTEST()
327 sprintf(buffer, "%e", var.d); in ZTEST()
328 zassert_true((strcmp(buffer, "1.234000e-01") == 0), in ZTEST()
330 "output '%s'\n", buffer); in ZTEST()
332 sprintf(buffer, "%E", var.d); in ZTEST()
333 zassert_true((strcmp(buffer, "1.234000E-01") == 0), in ZTEST()
335 "output '%s'\n", buffer); in ZTEST()
339 sprintf(buffer, "%g", var.d); in ZTEST()
340 zassert_true((strcmp(buffer, "1.234e+09") == 0), in ZTEST()
342 "output '%s'\n", buffer); in ZTEST()
344 sprintf(buffer, "%G", var.d); in ZTEST()
345 zassert_true((strcmp(buffer, "1.234E+09") == 0), in ZTEST()
347 "output '%s'\n", buffer); in ZTEST()
350 sprintf(buffer, "%#.3g", var.d); in ZTEST()
351 zassert_true((strcmp(buffer, "150.") == 0), in ZTEST()
353 "output '%s'\n", buffer); in ZTEST()
356 sprintf(buffer, "%.2g", var.d); in ZTEST()
357 zassert_true((strcmp(buffer, "1.5e+02") == 0), in ZTEST()
359 "output '%s'\n", buffer); in ZTEST()
362 sprintf(buffer, "%.3g", var.d); in ZTEST()
363 zassert_true((strcmp(buffer, "151") == 0), in ZTEST()
365 "output '%s'\n", buffer); in ZTEST()
368 sprintf(buffer, "%#.3g", var.d); in ZTEST()
369 zassert_true((strcmp(buffer, "0.000150") == 0), in ZTEST()
371 "output '%s'\n", buffer); in ZTEST()
374 sprintf(buffer, "%.4g", var.d); in ZTEST()
375 zassert_true((strcmp(buffer, "0.0001505") == 0), in ZTEST()
377 "output '%s'\n", buffer); in ZTEST()
381 sprintf(buffer, "%g", var.d); in ZTEST()
383 zassert_true((strcmp(buffer, "5e-324") == 0), in ZTEST()
385 "output '%s'\n", buffer); in ZTEST()
387 zassert_true((strcmp(buffer, "4.94066e-324") == 0), in ZTEST()
389 "output '%s'\n", buffer); in ZTEST()
422 char buffer[100]; in ZTEST() local
425 buffer[0] = '\0'; in ZTEST()
426 len = tvsnprintf(buffer, 0, "%x", DEADBEEF); in ZTEST()
431 zassert_true((strcmp(buffer, "") == 0), in ZTEST()
433 "", buffer); in ZTEST()
436 len = tvsnprintf(buffer, 4, "%x", DEADBEEF); in ZTEST()
441 zassert_true((strcmp(buffer, "dea") == 0), in ZTEST()
443 "dea", buffer); in ZTEST()
477 char buffer[100]; in ZTEST() local
480 len = tvsprintf(buffer, "%x", DEADBEEF); in ZTEST()
485 zassert_true((strcmp(buffer, DEADBEEF_LHEX_STR) == 0), in ZTEST()
487 DEADBEEF_LHEX_STR, buffer); in ZTEST()
516 char buffer[100]; in ZTEST() local
519 buffer[0] = '\0'; in ZTEST()
520 len = snprintf(buffer, 0, "%x", DEADBEEF); in ZTEST()
525 zassert_true((strcmp(buffer, "") == 0), in ZTEST()
527 "", buffer); in ZTEST()
529 len = snprintf(buffer, 4, "%x", DEADBEEF); in ZTEST()
534 zassert_true((strcmp(buffer, "dea") == 0), in ZTEST()
536 "dea", buffer); in ZTEST()
552 char buffer[100]; in ZTEST() local
555 sprintf(buffer, "%p", (void *) DEADBEEF); in ZTEST()
556 zassert_false((strcmp(buffer, DEADBEEF_PTR_STR) != 0), in ZTEST()
557 "sprintf(%%p). Expected '%s', got '%s'", DEADBEEF_PTR_STR, buffer); in ZTEST()
563 sprintf(buffer, "test data %n test data", &count); in ZTEST()
568 zassert_false((strcmp(buffer, "test data test data") != 0), in ZTEST()
570 "test data test data", buffer); in ZTEST()
581 sprintf(buffer, "%*d", 10, 1234); in ZTEST()
582 zassert_true((strcmp(buffer, " 1234") == 0), in ZTEST()
584 " 1234", buffer); in ZTEST()
587 sprintf(buffer, "%*d", -10, 1234); in ZTEST()
588 zassert_true((strcmp(buffer, "1234 ") == 0), in ZTEST()
590 "1234 ", buffer); in ZTEST()
593 sprintf(buffer, "% d", 1234); in ZTEST()
594 zassert_true((strcmp(buffer, " 1234") == 0), in ZTEST()
596 " 1234", buffer); in ZTEST()
600 sprintf(buffer, "%hx", (unsigned short)1234); in ZTEST()
601 zassert_true((strcmp("4d2", buffer) == 0), in ZTEST()
602 "sprintf(%%hx). Expected '4d2', got '%s'", buffer); in ZTEST()
605 sprintf(buffer, "%lx", 1234ul); in ZTEST()
606 zassert_true((strcmp("4d2", buffer) == 0), in ZTEST()
607 "sprintf(%%lx). Expected '4d2', got '%s'", buffer); in ZTEST()
619 char buffer[100]; in ZTEST() local
624 len = sprintf(buffer, "%x", 0x11); in ZTEST()
629 zassert_true((strcmp(buffer, "11") == 0), in ZTEST()
631 "Expected '%s', got '%s'", "11", buffer); in ZTEST()
634 len = sprintf(buffer, "%x", DEADBEEF); in ZTEST()
639 zassert_true((strcmp(buffer, DEADBEEF_LHEX_STR) == 0), in ZTEST()
641 DEADBEEF_LHEX_STR, buffer); in ZTEST()
643 len = sprintf(buffer, "%X", DEADBEEF); in ZTEST()
650 zassert_true((strcmp(buffer, DEADBEEF_UHEX_STR) == 0), in ZTEST()
652 DEADBEEF_UHEX_STR, buffer); in ZTEST()
656 len = sprintf(buffer, "%u", DEADBEEF); in ZTEST()
661 zassert_true((strcmp(buffer, DEADBEEF_UNSIGNED_STR) == 0), in ZTEST()
663 DEADBEEF_UNSIGNED_STR, buffer); in ZTEST()
666 len = sprintf(buffer, "%d", (int) DEADBEEF); in ZTEST()
671 zassert_true((strcmp(buffer, DEADBEEF_SIGNED_STR) == 0), in ZTEST()
673 DEADBEEF_SIGNED_STR, buffer); in ZTEST()
682 len = sprintf(buffer, "%#o", DEADBEEF); in ZTEST()
687 zassert_true((strcmp(buffer, DEADBEEF_OCTAL_ALT_STR) == 0), in ZTEST()
689 DEADBEEF_OCTAL_ALT_STR, buffer); in ZTEST()
692 len = sprintf(buffer, "%o", DEADBEEF); in ZTEST()
697 zassert_true((strcmp(buffer, DEADBEEF_OCTAL_STR) == 0), in ZTEST()
699 DEADBEEF_OCTAL_STR, buffer); in ZTEST()
702 len = sprintf(buffer, "%#x", DEADBEEF); in ZTEST()
707 zassert_true((strcmp(buffer, DEADBEEF_LHEX_ALT_STR) == 0), in ZTEST()
709 DEADBEEF_LHEX_ALT_STR, buffer); in ZTEST()
712 len = sprintf(buffer, "%#X", DEADBEEF); in ZTEST()
717 zassert_true((strcmp(buffer, DEADBEEF_UHEX_ALT_STR) == 0), in ZTEST()
719 DEADBEEF_UHEX_ALT_STR, buffer); in ZTEST()
723 len = sprintf(buffer, "%+d", 1); in ZTEST()
728 zassert_true((strcmp(buffer, "+1") == 0), in ZTEST()
729 "sprintf(%%+d). Expected '+1', got '%s'\n", buffer); in ZTEST()
741 char buffer[400]; in ZTEST() local
743 sprintf(buffer, "%%"); in ZTEST()
744 zassert_true((strcmp(buffer, "%") == 0), in ZTEST()
745 "sprintf(%%). Expected '%%', got '%s'\n", buffer); in ZTEST()
747 sprintf(buffer, "%c", 't'); in ZTEST()
748 zassert_true((strcmp(buffer, "t") == 0), in ZTEST()
749 "sprintf(%%c). Expected 't', got '%s'\n", buffer); in ZTEST()
751 sprintf(buffer, "%s", "short string"); in ZTEST()
752 zassert_true((strcmp(buffer, "short string") == 0), in ZTEST()
754 "Expected 'short string', got '%s'\n", buffer); in ZTEST()
756 sprintf(buffer, "%s", REALLY_LONG_STRING); in ZTEST()
757 zassert_str_equal(buffer, REALLY_LONG_STRING, in ZTEST()