mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
unittests: Extends testcases for ssh_strreplace().
Signed-off-by: Sahana Prasad <sahana@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
committed by
Andreas Schneider
parent
240bf3236a
commit
10d27a0d42
@ -702,6 +702,25 @@ static void torture_ssh_strreplace(void **state)
|
||||
replaced_string = ssh_strreplace(test_string3, "test", "an");
|
||||
assert_string_equal(replaced_string, "this;an;is;a");
|
||||
free(replaced_string);
|
||||
|
||||
/* pattern not found in teststring */
|
||||
replaced_string = ssh_strreplace(test_string1, "banana", "an");
|
||||
assert_string_equal(replaced_string, test_string1);
|
||||
free(replaced_string);
|
||||
|
||||
/* pattern is NULL */
|
||||
replaced_string = ssh_strreplace(test_string1, NULL , "an");
|
||||
assert_string_equal(replaced_string, test_string1);
|
||||
free(replaced_string);
|
||||
|
||||
/* replacement is NULL */
|
||||
replaced_string = ssh_strreplace(test_string1, "test", NULL);
|
||||
assert_string_equal(replaced_string, test_string1);
|
||||
free(replaced_string);
|
||||
|
||||
/* src is NULL */
|
||||
replaced_string = ssh_strreplace(NULL, "test", "kiwi");
|
||||
assert_null(replaced_string);
|
||||
}
|
||||
|
||||
int torture_run_tests(void) {
|
||||
|
Reference in New Issue
Block a user