new strops_length and strops_copy

This commit is contained in:
2025-05-21 17:50:05 +02:00
parent 1418c2843e
commit 9610831c9e
3 changed files with 204 additions and 120 deletions

35
tests.c
View File

@ -57,6 +57,38 @@ int test_() {
}
*/
int test_contains_char() {
int ret = 1;
char* input;
char expected;
char result;
input = "string";
expected = 1;
result = strops_contains_char(input, 'i');
if (result != expected) {
printf("test_ failed\n");
printf("Got = %d\nExpected = %d\n", result, expected);
ret = 0;
}
return ret;
}
int test_contains_string() {
int ret = 1;
char* input;
char expected;
char result;
input = "I suck at C";
expected = 1;
result = strops_contains_string(input, "C");
if (result != expected) {
printf("test_ failed\n");
printf("Got = %d\nExpected = %d\n", result, expected);
ret = 0;
}
return ret;
}
int test_to_lowercase() {
int ret = 1;
char* input;
@ -506,6 +538,9 @@ int test_url_decode() {
int main() {
Tests tests = { 0 };
da_append(&tests, test_contains_char);
da_append(&tests, test_contains_string);
da_append(&tests, test_to_lowercase);
da_append(&tests, test_to_uppercase);