1
1
mirror of https://github.com/theoludwig/libcproject.git synced 2025-05-21 23:21:15 +02:00

perf: mutate destination string for string_concatenate

BREAKING CHANGE: Function signature changed
This commit is contained in:
2023-08-07 00:42:11 +02:00
parent b922fd9cd3
commit e5190818c4
5 changed files with 30 additions and 31 deletions

View File

@ -158,12 +158,14 @@ void string_join_test() {
}
void string_concatenate_test() {
char* result = string_concatenate("abc", "def");
string_t result = string_copy("abc");
string_concatenate(&result, "def");
assert(assert_string_equal(result, "abcdef"));
free(result);
result = string_concatenate("abc", " defghi");
assert(assert_string_equal(result, "abc defghi"));
result = string_copy("abcz");
string_concatenate(&result, " defghi");
assert(assert_string_equal(result, "abcz defghi"));
free(result);
}