not implementing those
This commit is contained in:
10
strops.c
10
strops.c
@ -185,16 +185,6 @@ char* strops_remove_at_pos_char(const char* string, ull_t pos) {
|
||||
return result;
|
||||
}
|
||||
|
||||
char* strops_remove_at_pos_string(const char* string, const char* string_to_remove, ull_t pos) {
|
||||
char* result = strops_copy(string);
|
||||
return result;
|
||||
}
|
||||
|
||||
char* strops_replace_at_pos_string(const char* string, const char* string_to_remove, const char* string_to_insert, ull_t pos) {
|
||||
char* result = strops_copy(string);
|
||||
return result;
|
||||
}
|
||||
|
||||
char* strops_trim_right_whitespace(const char* string) {
|
||||
char* result = strops_copy(string);
|
||||
while (strops_contains_char("\t\n\v\f\r ", result[strops_length(result) - 1])) {
|
||||
|
2
strops.h
2
strops.h
@ -23,8 +23,6 @@ int strops_is_uppercase(const char* string);
|
||||
|
||||
char* strops_insert_at_pos_string(const char* string, const char* string_to_insert, ull_t pos);
|
||||
char* strops_remove_at_pos_char(const char* string, ull_t pos);
|
||||
char* strops_remove_at_pos_string(const char* string, const char* string_to_remove, ull_t pos);
|
||||
char* strops_replace_at_pos_string(const char* string, const char* string_to_remove, const char* string_to_insert, ull_t pos);
|
||||
|
||||
char* strops_trim_right_whitespace(const char* string);
|
||||
char* strops_trim_left_whitespace(const char* string);
|
||||
|
35
tests.c
35
tests.c
@ -1,7 +1,6 @@
|
||||
#include "strops.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <execinfo.h>
|
||||
|
||||
/* https://gist.githubusercontent.com/rexim/b5b0c38f53157037923e7cdd77ce685d/raw/86c3db57f485f3b6f7958f308ba7126fa81282d8/da_append.c */
|
||||
#define da_append(xs, x) \
|
||||
@ -217,38 +216,6 @@ int test_remove_at_pos_char() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_remove_at_pos_string() {
|
||||
int ret = 1;
|
||||
char* input;
|
||||
char* expected;
|
||||
char* result;
|
||||
input = "NULL BRUH NULL";
|
||||
expected = "NULL NULL";
|
||||
result = strops_remove_at_pos_string(input, " BRUH", 4);
|
||||
if (strcmp(result, expected) != 0) {
|
||||
printf("test_remove_at_pos_string failed\n");
|
||||
printf("Got = '%s'\nExpected = '%s'\n", result, expected);
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_replace_at_pos_string() {
|
||||
int ret = 1;
|
||||
char* input;
|
||||
char* expected;
|
||||
char* result;
|
||||
input = "What happened in Tiananmen Square in 1989";
|
||||
expected = "Nothing happened in Tiananmen Square in 1989";
|
||||
result = strops_replace_at_pos_string(input, "What", "Nothing", 0);
|
||||
if (strcmp(result, expected) != 0) {
|
||||
printf("test_replace_at_pos_string failed\n");
|
||||
printf("Got = '%s'\nExpected = '%s'\n", result, expected);
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test_trim_right_whitespace() {
|
||||
int ret = 1;
|
||||
char* input;
|
||||
@ -454,8 +421,6 @@ int main() {
|
||||
|
||||
da_append(&tests, test_insert_at_pos_string);
|
||||
da_append(&tests, test_remove_at_pos_char);
|
||||
da_append(&tests, test_remove_at_pos_string);
|
||||
da_append(&tests, test_replace_at_pos_string);
|
||||
|
||||
da_append(&tests, test_trim_right_whitespace);
|
||||
da_append(&tests, test_trim_left_whitespace);
|
||||
|
Reference in New Issue
Block a user