2025-02-10 21:17:01 +00:00
|
|
|
#include <CuTest.h>
|
2025-02-13 18:03:09 +00:00
|
|
|
#include <blue/core/stringstream.h>
|
2025-02-10 21:17:01 +00:00
|
|
|
#include <blue/io/path.h>
|
2025-02-13 18:03:09 +00:00
|
|
|
#include <stdio.h>
|
2025-02-10 21:17:01 +00:00
|
|
|
|
|
|
|
|
void test_path_1(CuTest *tc)
|
|
|
|
|
{
|
|
|
|
|
b_path *path = b_path_create_from_cstr("C:\\hello\\world\\");
|
|
|
|
|
char buf[512];
|
2025-10-24 12:51:54 +01:00
|
|
|
b_stringstream *str = b_stringstream_create_with_buffer(buf, sizeof buf);
|
2025-02-10 21:17:01 +00:00
|
|
|
|
2025-10-24 12:51:54 +01:00
|
|
|
b_object_to_string(path, str);
|
2025-02-10 21:17:01 +00:00
|
|
|
|
|
|
|
|
printf("%s\n", buf);
|
|
|
|
|
|
|
|
|
|
b_path *path2 = b_path_create_from_cstr("path1\\path2\\");
|
|
|
|
|
b_path *path3 = b_path_create_from_cstr("path3\\path4\\");
|
|
|
|
|
|
2025-02-13 18:03:09 +00:00
|
|
|
const b_path *paths[] = {path, path2, path3};
|
2025-02-10 21:17:01 +00:00
|
|
|
|
2025-02-13 18:03:09 +00:00
|
|
|
b_path *path4 = b_path_join(paths, sizeof paths / sizeof paths[0]);
|
2025-02-10 21:17:01 +00:00
|
|
|
|
2025-10-24 12:51:54 +01:00
|
|
|
b_stringstream_reset_with_buffer(str, buf, sizeof buf);
|
|
|
|
|
b_object_to_string(path4, str);
|
2025-02-10 21:17:01 +00:00
|
|
|
printf("%s\n", buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CuSuite *get_all_tests(void)
|
|
|
|
|
{
|
|
|
|
|
CuSuite *suite = CuSuiteNew();
|
|
|
|
|
|
|
|
|
|
SUITE_ADD_TEST(suite, test_path_1);
|
|
|
|
|
|
|
|
|
|
return suite;
|
|
|
|
|
}
|