Skip to content

Commit 101629c

Browse files
committed
more tests
1 parent 465dbac commit 101629c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_append_binary_partial.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "string_buffer.h"
2+
#include "test.h"
3+
#include <stdlib.h>
4+
5+
6+
void test_impl()
7+
{
8+
struct StringBuffer *buffer = string_buffer_new();
9+
10+
assert_true(string_buffer_append_binary(buffer, "12345", 1, 2));
11+
12+
assert_num_equal(string_buffer_get_initial_size(buffer), STRING_BUFFER_INITIAL_BUFFER_SIZE);
13+
assert_num_equal(string_buffer_get_content_size(buffer), 2);
14+
assert_num_equal(string_buffer_get_max_size(buffer), string_buffer_get_initial_size(buffer));
15+
16+
char *content = string_buffer_to_string(buffer);
17+
assert_string_equal(content, "23");
18+
19+
string_buffer_release(buffer);
20+
free(content);
21+
}
22+
23+
24+
int main()
25+
{
26+
test_run(test_impl);
27+
}
28+

0 commit comments

Comments
 (0)