Lines Matching refs:sb

11 static ssize_t add_string(struct strbuf *sb, const char *s) {  in add_string()  argument
12 return strbuf_add_string(sb, s, strlen(s)); in add_string()
16 _cleanup_(strbuf_freep) struct strbuf *sb; in TEST() local
20 sb = strbuf_new(); in TEST()
22 a = add_string(sb, "waldo"); in TEST()
23 b = add_string(sb, "foo"); in TEST()
24 c = add_string(sb, "bar"); in TEST()
25 d = add_string(sb, "waldo"); /* duplicate */ in TEST()
26 e = add_string(sb, "aldo"); /* duplicate */ in TEST()
27 f = add_string(sb, "do"); /* duplicate */ in TEST()
28 g = add_string(sb, "waldorf"); /* not a duplicate: matches from tail */ in TEST()
29 h = add_string(sb, ""); in TEST()
32 l = strv_parse_nulstr(sb->buf, sb->len); in TEST()
42 assert_se(sb->nodes_count == 5); /* root + 4 non-duplicates */ in TEST()
43 assert_se(sb->dedup_count == 4); in TEST()
44 assert_se(sb->in_count == 8); in TEST()
46 assert_se(sb->in_len == 29); /* length of all strings added */ in TEST()
47 assert_se(sb->dedup_len == 11); /* length of all strings duplicated */ in TEST()
48 assert_se(sb->len == 23); /* buffer length: in - dedup + \0 for each node */ in TEST()
60 assert_se(streq(sb->buf + a, "waldo")); in TEST()
61 assert_se(streq(sb->buf + b, "foo")); in TEST()
62 assert_se(streq(sb->buf + c, "bar")); in TEST()
63 assert_se(streq(sb->buf + d, "waldo")); in TEST()
64 assert_se(streq(sb->buf + e, "aldo")); in TEST()
65 assert_se(streq(sb->buf + f, "do")); in TEST()
66 assert_se(streq(sb->buf + g, "waldorf")); in TEST()
67 assert_se(streq(sb->buf + h, "")); in TEST()
69 strbuf_complete(sb); in TEST()
70 assert_se(sb->root == NULL); in TEST()