Lines Matching refs:sbuf
28 struct scratchbuf sbuf; in test_scratchbuf_onlystack() local
33 scratchbuf_init(&sbuf, buf, sizeof(buf)); in test_scratchbuf_onlystack()
34 assert_return(scratchbuf_alloc(&sbuf, strlen(smallstr) + 1) == 0, EXIT_FAILURE); in test_scratchbuf_onlystack()
35 assert_return(sbuf.need_free == false, EXIT_FAILURE); in test_scratchbuf_onlystack()
36 scratchbuf_release(&sbuf); in test_scratchbuf_onlystack()
38 scratchbuf_init(&sbuf, buf2, sizeof(buf2)); in test_scratchbuf_onlystack()
39 assert_return(scratchbuf_alloc(&sbuf, strlen(smallstr) + 1) == 0, EXIT_FAILURE); in test_scratchbuf_onlystack()
40 assert_return(sbuf.need_free == false, EXIT_FAILURE); in test_scratchbuf_onlystack()
41 scratchbuf_release(&sbuf); in test_scratchbuf_onlystack()
43 memcpy(scratchbuf_str(&sbuf), smallstr, strlen(smallstr) + 1); in test_scratchbuf_onlystack()
44 assert_return(strcmp(scratchbuf_str(&sbuf), smallstr) == 0, EXIT_FAILURE); in test_scratchbuf_onlystack()
54 struct scratchbuf sbuf; in test_scratchbuf_heap() local
60 scratchbuf_init(&sbuf, buf, sizeof(buf)); in test_scratchbuf_heap()
63 assert_return(scratchbuf_alloc(&sbuf, strlen(smallstr) + 1) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
64 assert_return(sbuf.need_free == false, EXIT_FAILURE); in test_scratchbuf_heap()
65 memcpy(scratchbuf_str(&sbuf), smallstr, strlen(smallstr) + 1); in test_scratchbuf_heap()
68 assert_return(scratchbuf_alloc(&sbuf, strlen(largestr) + 1) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
69 assert_return(sbuf.need_free == true, EXIT_FAILURE); in test_scratchbuf_heap()
70 assert_return(sbuf.size == strlen(largestr) + 1, EXIT_FAILURE); in test_scratchbuf_heap()
71 assert_return(strcmp(scratchbuf_str(&sbuf), smallstr) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
72 memcpy(scratchbuf_str(&sbuf), largestr, strlen(largestr) + 1); in test_scratchbuf_heap()
73 assert_return(strcmp(scratchbuf_str(&sbuf), largestr) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
76 assert_return(scratchbuf_alloc(&sbuf, strlen(largestr2) + 1) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
77 assert_return(sbuf.need_free == true, EXIT_FAILURE); in test_scratchbuf_heap()
78 assert_return(sbuf.size == strlen(largestr2) + 1, EXIT_FAILURE); in test_scratchbuf_heap()
79 memcpy(scratchbuf_str(&sbuf), largestr2, strlen(largestr2) + 1); in test_scratchbuf_heap()
80 assert_return(strcmp(scratchbuf_str(&sbuf), largestr2) == 0, EXIT_FAILURE); in test_scratchbuf_heap()
82 scratchbuf_release(&sbuf); in test_scratchbuf_heap()