shlwapi/tests: Simplify empty string check (PVS-Studio).
This commit is contained in:
parent
bd6c16628f
commit
e3c44185ed
|
@ -634,8 +634,7 @@ static void test_PathCombineA(void)
|
|||
ok(str == NULL ||
|
||||
broken(str != NULL), /* Win95 and some W2K */
|
||||
"Expected str == NULL, got %p\n", str);
|
||||
ok(lstrlenA(dest) == 0 ||
|
||||
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -724,8 +723,7 @@ static void test_PathCombineA(void)
|
|||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, "C:\\", too_long);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(lstrlenA(dest) == 0 ||
|
||||
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -734,8 +732,7 @@ static void test_PathCombineA(void)
|
|||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, too_long, "one\\two\\three");
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(lstrlenA(dest) == 0 ||
|
||||
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -749,8 +746,7 @@ static void test_PathCombineA(void)
|
|||
lstrcpyA(dest, "control");
|
||||
str = PathCombineA(dest, one, two);
|
||||
ok(str == NULL, "Expected str == NULL, got %p\n", str);
|
||||
ok(lstrlenA(dest) == 0 ||
|
||||
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
|
||||
"Expected 0 length, got %i\n", lstrlenA(dest));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
}
|
||||
|
@ -772,7 +768,7 @@ static void test_PathAddBackslash(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
str = PathAddBackslashA(path);
|
||||
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
|
||||
ok(lstrlenA(path) == 0, "Expected empty string, got %i\n", lstrlenA(path));
|
||||
ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
/* try a relative path */
|
||||
|
@ -917,8 +913,7 @@ static void test_PathAppendA(void)
|
|||
res = PathAppendA(too_long, "two\\three");
|
||||
ok(!res, "Expected failure\n");
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(lstrlenA(too_long) == 0 ||
|
||||
broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
|
||||
ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
|
||||
"Expected length of too_long to be zero, got %i\n", lstrlenA(too_long));
|
||||
|
||||
/* pszMore is too long */
|
||||
|
@ -929,8 +924,7 @@ static void test_PathAppendA(void)
|
|||
res = PathAppendA(path, too_long);
|
||||
ok(!res, "Expected failure\n");
|
||||
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
ok(lstrlenA(path) == 0 ||
|
||||
broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
|
||||
ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
|
||||
"Expected length of path to be zero, got %i\n", lstrlenA(path));
|
||||
|
||||
/* both params combined are too long */
|
||||
|
@ -941,8 +935,7 @@ static void test_PathAppendA(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
res = PathAppendA(path, half);
|
||||
ok(!res, "Expected failure\n");
|
||||
ok(lstrlenA(path) == 0 ||
|
||||
broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
|
||||
ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
|
||||
"Expected length of path to be zero, got %i\n", lstrlenA(path));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
}
|
||||
|
@ -1092,7 +1085,7 @@ static void test_PathFindExtensionA(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ext = PathFindExtensionA(path);
|
||||
ok(ext == path, "Expected ext == path, got %p\n", ext);
|
||||
ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
/* try a path without an extension */
|
||||
|
@ -1100,7 +1093,7 @@ static void test_PathFindExtensionA(void)
|
|||
SetLastError(0xdeadbeef);
|
||||
ext = PathFindExtensionA(path);
|
||||
ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext);
|
||||
ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
/* try a path with an extension */
|
||||
|
@ -1169,8 +1162,7 @@ static void test_PathBuildRootA(void)
|
|||
lstrcpyA(path, "aaaaaaaaa");
|
||||
root = PathBuildRootA(path, -1);
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") ||
|
||||
lstrlenA(path) == 0, /* Vista */
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
|
||||
"Expected aaaaaaaaa or empty string, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -1179,8 +1171,7 @@ static void test_PathBuildRootA(void)
|
|||
lstrcpyA(path, "aaaaaaaaa");
|
||||
root = PathBuildRootA(path, 26);
|
||||
ok(root == path, "Expected root == path, got %p\n", root);
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") ||
|
||||
lstrlenA(path) == 0, /* Vista */
|
||||
ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
|
||||
"Expected aaaaaaaaa or empty string, got %s\n", path);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -1238,8 +1229,8 @@ static void test_PathCommonPrefixA(void)
|
|||
lstrcpyA(out, "aaa");
|
||||
count = PathCommonPrefixA(path1, path2, out);
|
||||
ok(count == 0, "Expected 0, got %i\n", count);
|
||||
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(lstrlenA(path1) == 0, "Expected 0 length path1, got %i\n", lstrlenA(path1));
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1));
|
||||
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -1250,8 +1241,8 @@ static void test_PathCommonPrefixA(void)
|
|||
lstrcpyA(out, "aaa");
|
||||
count = PathCommonPrefixA(path1, path2, out);
|
||||
ok(count == 0, "Expected 0, got %i\n", count);
|
||||
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(lstrlenA(path2) == 0, "Expected 0 length path2, got %i\n", lstrlenA(path2));
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2));
|
||||
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
|
||||
|
@ -1406,7 +1397,7 @@ static void test_PathCommonPrefixA(void)
|
|||
ok(count == 0, "Expected 0, got %i\n", count);
|
||||
ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
|
||||
ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2);
|
||||
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
|
||||
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue