Files
fx/fx.io/test/unit-tests.c
T

36 lines
827 B
C
Raw Normal View History

2025-02-10 21:17:01 +00:00
#include <CuTest.h>
2026-03-16 10:35:43 +00:00
#include <fx/core/stringstream.h>
#include <fx/io/path.h>
#include <stdio.h>
2025-02-10 21:17:01 +00:00
void test_path_1(CuTest *tc)
{
2026-03-16 10:35:43 +00:00
fx_path *path = fx_path_create_from_cstr("C:\\hello\\world\\");
2025-02-10 21:17:01 +00:00
char buf[512];
2026-03-16 10:35:43 +00:00
fx_stringstream *str = fx_stringstream_create_with_buffer(buf, sizeof buf);
2025-02-10 21:17:01 +00:00
2026-03-16 10:35:43 +00:00
fx_object_to_string(path, str);
2025-02-10 21:17:01 +00:00
printf("%s\n", buf);
2026-03-16 10:35:43 +00:00
fx_path *path2 = fx_path_create_from_cstr("path1\\path2\\");
fx_path *path3 = fx_path_create_from_cstr("path3\\path4\\");
2025-02-10 21:17:01 +00:00
2026-03-16 10:35:43 +00:00
const fx_path *paths[] = {path, path2, path3};
2025-02-10 21:17:01 +00:00
2026-03-16 10:35:43 +00:00
fx_path *path4 = fx_path_join(paths, sizeof paths / sizeof paths[0]);
2025-02-10 21:17:01 +00:00
2026-03-16 10:35:43 +00:00
fx_stringstream_reset_with_buffer(str, buf, sizeof buf);
fx_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;
}