static void test_stringbuffer_aprintf(void) { stringbuffer_t *sb; const char *str; sb = stringbuffer_create_with_size(2); stringbuffer_aprintf(sb, "hello %dth world", 14); str = stringbuffer_getstring(sb); CU_ASSERT_STRING_EQUAL("hello 14th world", str); stringbuffer_destroy(sb); }
/** * Allocate a new stringbuffer_t. Use stringbuffer_destroy to free. */ stringbuffer_t* stringbuffer_create(void) { return stringbuffer_create_with_size(STRINGBUFFER_STARTSIZE); }