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

feat: add string_zero_pad

This commit is contained in:
2024-09-12 12:31:58 +02:00
parent 35b868d0c1
commit c49d5f5421
4 changed files with 34 additions and 0 deletions

View File

@ -28,6 +28,7 @@ void string_test() {
string_position_of_test();
string_last_position_of_test();
string_pad_start_test();
string_zero_pad_test();
}
void string_get_length_test() {
@ -322,3 +323,13 @@ void string_pad_start_test() {
assert(assert_string_equal(result, "ahello"));
free(result);
}
void string_zero_pad_test() {
string_t result = string_zero_pad(1, 2);
assert(assert_string_equal(result, "01"));
free(result);
result = string_zero_pad(10, 2);
assert(assert_string_equal(result, "10"));
free(result);
}

View File

@ -64,4 +64,6 @@ void string_last_position_of_test();
void string_pad_start_test();
void string_zero_pad_test();
#endif