Lines Matching refs:str
56 atf_dynstr_t str;
58 RE(atf_dynstr_init(&str));
59 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
60 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
61 atf_dynstr_fini(&str);
66 init_fmt(atf_dynstr_t *str, const char *fmt, ...)
71 RE(atf_dynstr_init_ap(str, fmt, ap));
83 atf_dynstr_t str;
85 init_fmt(&str, "String 1");
86 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
87 atf_dynstr_fini(&str);
89 init_fmt(&str, "String %d", 2);
90 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
91 atf_dynstr_fini(&str);
93 init_fmt(&str, "%s %d", "String", 3);
94 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 3") == 0);
95 atf_dynstr_fini(&str);
97 init_fmt(&str, "%s%s%s%s%s%s%s", "This ", "should ", "be ", "a ",
99 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str),
102 atf_dynstr_fini(&str);
113 atf_dynstr_t str;
115 RE(atf_dynstr_init_fmt(&str, "String 1"));
116 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
117 atf_dynstr_fini(&str);
119 RE(atf_dynstr_init_fmt(&str, "String %d", 2));
120 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
121 atf_dynstr_fini(&str);
123 RE(atf_dynstr_init_fmt(&str, "%s %d", "String", 3));
124 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 3") == 0);
125 atf_dynstr_fini(&str);
127 RE(atf_dynstr_init_fmt(&str, "%s%s%s%s%s%s%s", "This ", "should ",
130 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str),
133 atf_dynstr_fini(&str);
145 atf_dynstr_t str;
147 RE(atf_dynstr_init_raw(&str, src, 0));
148 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
149 atf_dynstr_fini(&str);
151 RE(atf_dynstr_init_raw(&str, src, 8));
152 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 1") == 0);
153 atf_dynstr_fini(&str);
155 RE(atf_dynstr_init_raw(&str, src + 10, 8));
156 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String 2") == 0);
157 atf_dynstr_fini(&str);
159 RE(atf_dynstr_init_raw(&str, "String\0Lost", 11));
160 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "String") == 0);
161 atf_dynstr_fini(&str);
164 atf_error_t err = atf_dynstr_init_raw(&str, "NULL", SIZE_MAX - 1);
186 atf_dynstr_t str;
188 RE(atf_dynstr_init_rep(&str, i, 'a'));
190 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
196 atf_dynstr_fini(&str);
202 atf_dynstr_t str;
205 err = atf_dynstr_init_rep(&str, SIZE_MAX, 'a');
210 err = atf_dynstr_init_rep(&str, SIZE_MAX - 1, 'a');
226 atf_dynstr_t str;
230 RE(atf_dynstr_init_substr(&str, &src, 0, 0));
231 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
232 atf_dynstr_fini(&str);
234 RE(atf_dynstr_init_substr(&str, &src, 0, atf_dynstr_npos));
235 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1, Str 2") == 0);
236 atf_dynstr_fini(&str);
238 RE(atf_dynstr_init_substr(&str, &src, 0, 100));
239 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1, Str 2") == 0);
240 atf_dynstr_fini(&str);
242 RE(atf_dynstr_init_substr(&str, &src, 0, 5));
243 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 1") == 0);
244 atf_dynstr_fini(&str);
246 RE(atf_dynstr_init_substr(&str, &src, 100, atf_dynstr_npos));
247 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
248 atf_dynstr_fini(&str);
250 RE(atf_dynstr_init_substr(&str, &src, 7, atf_dynstr_npos));
251 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Str 2") == 0);
252 atf_dynstr_fini(&str);
264 atf_dynstr_t str, str2;
266 RE(atf_dynstr_init_fmt(&str, "Test string"));
267 RE(atf_dynstr_copy(&str2, &str));
269 ATF_REQUIRE(atf_equal_dynstr_dynstr(&str, &str2));
273 ATF_REQUIRE(!atf_equal_dynstr_dynstr(&str, &str2));
276 atf_dynstr_fini(&str);
289 atf_dynstr_t str;
291 RE(atf_dynstr_init_fmt(&str, "Test string 1"));
292 cstr = atf_dynstr_cstring(&str);
293 cstr2 = atf_dynstr_fini_disown(&str);
312 atf_dynstr_t str;
314 RE(atf_dynstr_init_fmt(&str, "Test string 1"));
315 cstr = atf_dynstr_cstring(&str);
318 atf_dynstr_fini(&str);
320 RE(atf_dynstr_init_fmt(&str, "Test string 2"));
321 cstr = atf_dynstr_cstring(&str);
324 atf_dynstr_fini(&str);
337 atf_dynstr_t str;
338 RE(atf_dynstr_init_rep(&str, i, 'a'));
339 ATF_REQUIRE_EQ(atf_dynstr_length(&str), i);
340 atf_dynstr_fini(&str);
352 atf_dynstr_t str;
354 RE(atf_dynstr_init_fmt(&str, "Foo1/Bar2/,.Baz"));
356 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '\0'), atf_dynstr_npos);
358 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '0'), atf_dynstr_npos);
359 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'b'), atf_dynstr_npos);
361 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'F'), 0);
362 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '/'), 9);
363 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'a'), 13);
364 ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'z'), 14);
366 atf_dynstr_fini(&str);
380 atf_dynstr_t str;
384 RE(atf_dynstr_init(&str));
386 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
391 RE(append(&str, "a"));
394 atf_dynstr_fini(&str);
398 RE(atf_dynstr_init(&str));
400 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
405 RE(append(&str, "%s", "a"));
408 atf_dynstr_fini(&str);
413 append_ap_aux(atf_dynstr_t *str, const char *fmt, ...)
419 err = atf_dynstr_append_ap(str, fmt, ap);
454 atf_dynstr_t str;
457 RE(atf_dynstr_init(&str));
458 atf_dynstr_clear(&str);
459 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
460 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
461 atf_dynstr_fini(&str);
464 RE(atf_dynstr_init_fmt(&str, "Not empty"));
465 ATF_REQUIRE_EQ(atf_dynstr_length(&str), strlen("Not empty"));
466 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "Not empty") == 0);
467 atf_dynstr_clear(&str);
468 ATF_REQUIRE_EQ(atf_dynstr_length(&str), 0);
469 ATF_REQUIRE(strcmp(atf_dynstr_cstring(&str), "") == 0);
470 atf_dynstr_fini(&str);
480 atf_dynstr_t str;
484 RE(atf_dynstr_init(&str));
486 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
493 RE(prepend(&str, "%s", "a"));
496 RE(prepend(&str, "%s", "b"));
500 atf_dynstr_fini(&str);
504 RE(atf_dynstr_init(&str));
506 if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
513 RE(prepend(&str, "%s", "a"));
516 RE(prepend(&str, "%s", "b"));
520 atf_dynstr_fini(&str);
525 prepend_ap_aux(atf_dynstr_t *str, const char *fmt, ...)
531 err = atf_dynstr_prepend_ap(str, fmt, ap);
571 atf_dynstr_t str;
573 RE(atf_dynstr_init(&str));
574 ATF_REQUIRE( atf_equal_dynstr_cstring(&str, ""));
575 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Test"));
576 atf_dynstr_fini(&str);
578 RE(atf_dynstr_init_fmt(&str, "Test"));
579 ATF_REQUIRE( atf_equal_dynstr_cstring(&str, "Test"));
580 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, ""));
581 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Tes"));
582 ATF_REQUIRE(!atf_equal_dynstr_cstring(&str, "Test "));
583 atf_dynstr_fini(&str);
594 atf_dynstr_t str, str2;
596 RE(atf_dynstr_init(&str));
598 ATF_REQUIRE( atf_equal_dynstr_dynstr(&str, &str));
599 ATF_REQUIRE(!atf_equal_dynstr_dynstr(&str, &str2));
601 atf_dynstr_fini(&str);