// Copyright 2023 alexevier // licensed under the zlib license #include #include #include #include"test.h" void testStrPath(void){ testStart("strPath"); unsigned char err = 0; #ifdef _WIN32 char patht[] = "yes\\ i exist\\path\\sub\\dir\\directowy\\protected\\important thing.txt"; #else char patht[] = "yes/ i exist/path/sub/dir/directowy/protected/important thing.txt"; #endif char* path = lexlibStrPathNew("yes/ i exist"); lexlibStrPathPush(&path, "path"); lexlibStrPathPush(&path, "sub/"); lexlibStrPathPush(&path, "/dir"); lexlibStrPathPush(&path, "/directowy/"); lexlibStrPathPush(&path, "protected"); lexlibStrPathAsDir(&path); lexlibStrPathPush(&path, "important thing.txt/"); lexlibStrPathAsFile(&path); if(strcmp(path, patht)) err = 1; free(path); if(err) testEnd("error"); else testEnd(NULL); }