Lines Matching defs:str
53 atf_dynstr_t str;
55 RE(atf_dynstr_init(&str));
56 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
57 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
58 atf_dynstr_fini(&str);
63 init_fmt(atf_dynstr_t *str, const char *fmt, ...)
68 RE(atf_dynstr_init_ap(str, fmt, ap));
80 atf_dynstr_t str;
82 init_fmt(&str, "String 1");
83 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
84 atf_dynstr_fini(&str);
86 init_fmt(&str, "String %d", 2);
87 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
88 atf_dynstr_fini(&str);
90 init_fmt(&str, "%s %d", "String", 3);
91 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 3") == 0);
92 atf_dynstr_fini(&str);
94 init_fmt(&str, "%s%s%s%s%s%s%s", "This ", "should ", "be ", "a ",
96 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str),
99 atf_dynstr_fini(&str);
110 atf_dynstr_t str;
112 RE(atf_dynstr_init_fmt(&str, "String 1"));
113 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
114 atf_dynstr_fini(&str);
116 RE(atf_dynstr_init_fmt(&str, "String %d", 2));
117 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
118 atf_dynstr_fini(&str);
120 RE(atf_dynstr_init_fmt(&str, "%s %d", "String", 3));
121 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 3") == 0);
122 atf_dynstr_fini(&str);
124 RE(atf_dynstr_init_fmt(&str, "%s%s%s%s%s%s%s", "This ", "should ",
127 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str),
130 atf_dynstr_fini(&str);
142 atf_dynstr_t str;
144 RE(atf_dynstr_init_raw(&str, src, 0));
145 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
146 atf_dynstr_fini(&str);
148 RE(atf_dynstr_init_raw(&str, src, 8));
149 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
150 atf_dynstr_fini(&str);
152 RE(atf_dynstr_init_raw(&str, src + 10, 8));
153 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
154 atf_dynstr_fini(&str);
156 RE(atf_dynstr_init_raw(&str, "String\0Lost", 11));
157 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String") == 0);
158 atf_dynstr_fini(&str);
161 atf_error_t err = atf_dynstr_init_raw(&str, "NULL", SIZE_MAX - 1);
183 atf_dynstr_t str;
185 RE(atf_dynstr_init_rep(&str, i, 'a'));
187 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
193 atf_dynstr_fini(&str);
199 atf_dynstr_t str;
202 err = atf_dynstr_init_rep(&str, SIZE_MAX, 'a');
207 err = atf_dynstr_init_rep(&str, SIZE_MAX - 1, 'a');
223 atf_dynstr_t str;
227 RE(atf_dynstr_init_substr(&str, &src, 0, 0));
228 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
229 atf_dynstr_fini(&str);
231 RE(atf_dynstr_init_substr(&str, &src, 0, atf_dynstr_npos));
232 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1, Str 2") == 0);
233 atf_dynstr_fini(&str);
235 RE(atf_dynstr_init_substr(&str, &src, 0, 100));
236 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1, Str 2") == 0);
237 atf_dynstr_fini(&str);
239 RE(atf_dynstr_init_substr(&str, &src, 0, 5));
240 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1") == 0);
241 atf_dynstr_fini(&str);
243 RE(atf_dynstr_init_substr(&str, &src, 100, atf_dynstr_npos));
244 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
245 atf_dynstr_fini(&str);
247 RE(atf_dynstr_init_substr(&str, &src, 7, atf_dynstr_npos));
248 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 2") == 0);
249 atf_dynstr_fini(&str);
261 atf_dynstr_t str, str2;
263 RE(atf_dynstr_init_fmt(&str, "Test string"));
264 RE(atf_dynstr_copy(&str2, &str));
266 ATF_REQUIRE(atf_equal_dynstr_dynstr(&str, &str2));
270 ATF_REQUIRE(!atf_equal_dynstr_dynstr(&str, &str2));
273 atf_dynstr_fini(&str);
286 atf_dynstr_t str;
288 RE(atf_dynstr_init_fmt(&str, "Test string 1"));
289 cstr = atf_dynstr_cstring(&str);
290 cstr2 = atf_dynstr_fini_disown(&str);
309 atf_dynstr_t str;
311 RE(atf_dynstr_init_fmt(&str, "Test string 1"));
312 cstr = atf_dynstr_cstring(&str);
315 atf_dynstr_fini(&str);
317 RE(atf_dynstr_init_fmt(&str, "Test string 2"));
318 cstr = atf_dynstr_cstring(&str);
321 atf_dynstr_fini(&str);
334 atf_dynstr_t str;
335 RE(atf_dynstr_init_rep(&str, i, 'a'));
336 ATF_REQUIRE_EQ(atf_dynstr_length(&str), i);
337 atf_dynstr_fini(&str);
349 atf_dynstr_t str;
351 RE(atf_dynstr_init_fmt(&str, "Foo1/Bar2/,.Baz"));
353 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '\0'), atf_dynstr_npos);
355 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '0'), atf_dynstr_npos);
356 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'b'), atf_dynstr_npos);
358 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'F'), 0);
359 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '/'), 9);
360 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'a'), 13);
361 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'z'), 14);
363 atf_dynstr_fini(&str);
377 atf_dynstr_t str;
381 RE(atf_dynstr_init(&str));
383 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
388 RE(append(&str, "a"));
391 atf_dynstr_fini(&str);
395 RE(atf_dynstr_init(&str));
397 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
402 RE(append(&str, "%s", "a"));
405 atf_dynstr_fini(&str);
410 append_ap_aux(atf_dynstr_t *str, const char *fmt, ...)
416 err = atf_dynstr_append_ap(str, fmt, ap);
451 atf_dynstr_t str;
454 RE(atf_dynstr_init(&str));
455 atf_dynstr_clear(&str);
456 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
457 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
458 atf_dynstr_fini(&str);
461 RE(atf_dynstr_init_fmt(&str, "Not empty"));
462 ATF_REQUIRE_EQ(atf_dynstr_length(&str), strlen("Not empty"));
463 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Not empty") == 0);
464 atf_dynstr_clear(&str);
465 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
466 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
467 atf_dynstr_fini(&str);
477 atf_dynstr_t str;
481 RE(atf_dynstr_init(&str));
483 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
490 RE(prepend(&str, "%s", "a"));
493 RE(prepend(&str, "%s", "b"));
497 atf_dynstr_fini(&str);
501 RE(atf_dynstr_init(&str));
503 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
510 RE(prepend(&str, "%s", "a"));
513 RE(prepend(&str, "%s", "b"));
517 atf_dynstr_fini(&str);
522 prepend_ap_aux(atf_dynstr_t *str, const char *fmt, ...)
528 err = atf_dynstr_prepend_ap(str, fmt, ap);
568 atf_dynstr_t str;
570 RE(atf_dynstr_init(&str));
571 ATF_REQUIRE( atf_equal_dynstr_cstring(&str, ""));
572 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Test"));
573 atf_dynstr_fini(&str);
575 RE(atf_dynstr_init_fmt(&str, "Test"));
576 ATF_REQUIRE( atf_equal_dynstr_cstring(&str, "Test"));
577 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, ""));
578 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Tes"));
579 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Test "));
580 atf_dynstr_fini(&str);
591 atf_dynstr_t str, str2;
593 RE(atf_dynstr_init(&str));
595 ATF_REQUIRE( atf_equal_dynstr_dynstr(&str, &str));
596 ATF_REQUIRE(!atf_equal_dynstr_dynstr(&str, &str2));
598 atf_dynstr_fini(&str);