mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 21:46:22 +00:00
Removed trim method from util
This commit is contained in:
64
test_util.c
64
test_util.c
@@ -146,64 +146,6 @@ void replace_when_new_null(void)
|
||||
assert_string_equals("hello", result);
|
||||
}
|
||||
|
||||
void trim_when_no_whitespace_returns_same(void)
|
||||
{
|
||||
char *str = malloc((strlen("hi there") + 1) * sizeof(char));
|
||||
strcpy(str, "hi there");
|
||||
char *result = trim(str);
|
||||
|
||||
assert_string_equals("hi there", result);
|
||||
free(str);
|
||||
}
|
||||
|
||||
void trim_when_space_at_start(void)
|
||||
{
|
||||
char *str = malloc((strlen(" hi there") + 1) * sizeof(char));
|
||||
strcpy(str, " hi there");
|
||||
char *result = trim(str);
|
||||
|
||||
assert_string_equals("hi there", result);
|
||||
free(str);
|
||||
}
|
||||
|
||||
void trim_when_space_at_end(void)
|
||||
{
|
||||
char *str = malloc((strlen("hi there ") + 1) * sizeof(char));
|
||||
strcpy(str, "hi there ");
|
||||
char *result = trim(str);
|
||||
|
||||
assert_string_equals("hi there", result);
|
||||
free(str);
|
||||
}
|
||||
|
||||
void trim_when_space_at_start_and_end(void)
|
||||
{
|
||||
char *str = malloc((strlen(" hi there ") + 1) * sizeof(char));
|
||||
strcpy(str, " hi there ");
|
||||
char *result = trim(str);
|
||||
|
||||
assert_string_equals("hi there", result);
|
||||
free(str);
|
||||
}
|
||||
|
||||
void trim_when_empty(void)
|
||||
{
|
||||
char *str = malloc((strlen("") + 1) * sizeof(char));
|
||||
strcpy(str, "");
|
||||
char *result = trim(str);
|
||||
|
||||
assert_string_equals("", result);
|
||||
free(str);
|
||||
}
|
||||
|
||||
void trim_when_null(void)
|
||||
{
|
||||
char *str = NULL;
|
||||
char *result = trim(str);
|
||||
|
||||
assert_is_null(result);
|
||||
}
|
||||
|
||||
void register_util_tests(void)
|
||||
{
|
||||
TEST_MODULE("util tests");
|
||||
@@ -220,10 +162,4 @@ void register_util_tests(void)
|
||||
TEST(replace_when_sub_null);
|
||||
TEST(replace_when_new_empty);
|
||||
TEST(replace_when_new_null);
|
||||
TEST(trim_when_no_whitespace_returns_same);
|
||||
TEST(trim_when_space_at_start);
|
||||
TEST(trim_when_space_at_end);
|
||||
TEST(trim_when_space_at_start_and_end);
|
||||
TEST(trim_when_empty);
|
||||
TEST(trim_when_null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user