5#include <winpr/tchar.h>
6#include <winpr/winpr.h>
16static BOOL test(
size_t count,
const test_case_t* cur)
19 WINPR_ASSERT(cur->what);
21 const size_t len = strlen(cur->what);
22 char* out = calloc(len + 1,
sizeof(
char));
27 HRESULT hr = PathCchCanonicalize(out, len, cur->what);
28 if (hr != cur->result)
32 "[%s: %" PRIuz
": got result 0x%08" PRIx32
", expected 0x%08" PRIx32
"\n",
33 __FILE__, count, hr, cur->result);
37 rc = strcmp(out, cur->expect) == 0;
39 (void)fprintf(stderr,
"[%s: %" PRIuz
": got result '%s', expected '%s'\n", __FILE__,
40 count, out, cur->expect);
46int TestPathCchCanonicalize(
int argc,
char* argv[])
48 const test_case_t tests[] = {
49 {
"////", S_OK,
"/" },
50 {
"///foo///bar//..///lala/././///.///.", S_OK,
"/foo/lala" },
51 {
"////..////.", S_OK,
"/" },
52 {
"///./gaga////foo/..///bar/..", S_OK,
"/gaga" },
56 for (
size_t x = 0; x < ARRAYSIZE(tests); x++)
58 const test_case_t* cur = &tests[x];