Improving string for C++
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
#include "../core_library/core.c"
|
||||
|
||||
int main() {
|
||||
MA_Scratch scratch;
|
||||
for (OS_FileIter it = OS_IterateFiles(scratch, "../"_s); OS_IsValid(it); OS_Advance(&it)) {
|
||||
IO_Printf("is_directory: %d\n", it.is_directory);
|
||||
IO_Printf("absolute_path: %.*s\n", S8_Expand(it.absolute_path));
|
||||
IO_Printf("relative_path: %.*s\n", S8_Expand(it.relative_path));
|
||||
S8_String s = "mrówka";
|
||||
|
||||
bool found_two_byte = false;
|
||||
For(s) {
|
||||
if (it.utf8_codepoint_byte_size == 2) {
|
||||
found_two_byte = true;
|
||||
IO_Assert(it.i == 2);
|
||||
}
|
||||
}
|
||||
IO_Assert(found_two_byte);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#include "../core_library/core.h"
|
||||
|
||||
int main() {
|
||||
MA_Arena arena = {};
|
||||
int *a = MA_PushStruct(&arena, int);
|
||||
*a = 10;
|
||||
return 0;
|
||||
}
|
||||
@@ -67,11 +67,21 @@ int main() {
|
||||
IO_Assert(OS_IsAbsolute(work_path));
|
||||
IO_Assert(OS_IsAbsolute(abs_path));
|
||||
|
||||
IO_Assert(S8_Find(exe_path, S8_Lit("/test_filesystem"), 0, 0));
|
||||
IO_Assert(S8_Find(exe_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Find(dir_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Find(work_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Find(abs_path, S8_Lit("/tests/data"), 0, 0));
|
||||
IO_Assert(!S8_Find(abs_path, S8_Lit("../"), 0, 0));
|
||||
IO_Assert(S8_Seek(exe_path, S8_Lit("/test_filesystem"), 0, 0));
|
||||
IO_Assert(S8_Seek(exe_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Seek(dir_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Seek(work_path, S8_Lit("/build"), 0, 0));
|
||||
IO_Assert(S8_Seek(abs_path, S8_Lit("/tests/data"), 0, 0));
|
||||
IO_Assert(!S8_Seek(abs_path, S8_Lit("../"), 0, 0));
|
||||
}
|
||||
|
||||
{
|
||||
for (OS_FileIter it = OS_IterateFiles(&arena, S8_Lit("..")); OS_IsValid(it); OS_Advance(&it)) {
|
||||
if (it.is_directory) {
|
||||
IO_Assert(it.absolute_path.str[it.absolute_path.len - 1] == '/');
|
||||
}
|
||||
IO_Assert(!S8_Seek(it.absolute_path, S8_Lit(".."), 0, 0));
|
||||
IO_Assert(S8_Seek(it.relative_path, S8_Lit(".."), 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user