Refactor string
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/* Copyright © 2022 Gregory Lirent */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../../include/extra/vtype.h"
|
||||
#include "../../include/vtype.h"
|
||||
|
||||
#ifndef LIBCDSB_TESTS_TEST_H
|
||||
#define LIBCDSB_TESTS_TEST_H
|
||||
|
||||
@@ -18,10 +18,10 @@ int main(int argc, char** argv) {
|
||||
|
||||
{
|
||||
char* repl = random_utf8_cstring(30);
|
||||
void* hack = string_at(&x, 31);
|
||||
void* hack = at_string(&x, 31);
|
||||
string_print((void*)&hack, "(part 2)");
|
||||
string_print((void*)&repl, "(part 2 replaced)");
|
||||
string_replace(&x, hack, repl, -1);
|
||||
string_replace(&x, hack, repl);
|
||||
free(repl);
|
||||
}
|
||||
|
||||
@@ -54,16 +54,16 @@ int main(int argc, char** argv) {
|
||||
|
||||
x = string_random(12);
|
||||
|
||||
string_align_center(&x, 30, 0);
|
||||
string_align(&x, 30, 0);
|
||||
string_info(&x);
|
||||
string_print(&x, 0);
|
||||
|
||||
string_trim_spaces(&x);
|
||||
string_trim(&x, 0);
|
||||
string_info(&x);
|
||||
string_print(&x, "trimmed");
|
||||
|
||||
put_separator(0);
|
||||
string_align_center(&x, 30, c);
|
||||
string_align(&x, 30, c);
|
||||
string_info(&x);
|
||||
string_print(&x, 0);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "../../../modules/libunic/include.h"
|
||||
#include "../../../include/extra/string.h"
|
||||
#include "../../../include/string.h"
|
||||
|
||||
#include "../../include/random.h"
|
||||
#include "../../include/test.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ void string_replace_random(str_t* x, unsigned int n) {
|
||||
v = random_utf8_cstring(n);
|
||||
} else v = random_ascii_cstring(n);
|
||||
|
||||
string_replace(x, x, v, -1);
|
||||
string_replace(x, x, v);
|
||||
|
||||
free(v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user