James Hawkins : shlwapi: Add tests for PathBuildRootA.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 13 10:12:23 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: a6f4ede2557d83c2f659b8f320e2b53658ac8448
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a6f4ede2557d83c2f659b8f320e2b53658ac8448
Author: James Hawkins <truiken at gmail.com>
Date: Wed Jul 12 17:18:37 2006 -0700
shlwapi: Add tests for PathBuildRootA.
---
dlls/shlwapi/tests/path.c | 55 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c
index 183c936..0f9a2cf 100644
--- a/dlls/shlwapi/tests/path.c
+++ b/dlls/shlwapi/tests/path.c
@@ -1485,6 +1485,60 @@ static void test_PathFindExtensionA(void
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
}
+static void test_PathBuildRootA(void)
+{
+ LPSTR root;
+ char path[10];
+ char root_expected[26][4];
+ char drive;
+ int j;
+
+ /* set up the expected paths */
+ for (drive = 'A'; drive <= 'Z'; drive++)
+ sprintf(root_expected[drive - 'A'], "%c:\\", drive);
+
+ /* test the expected values */
+ for (j = 0; j < 26; j++)
+ {
+ SetLastError(0xdeadbeef);
+ lstrcpy(path, "aaaaaaaaa");
+ root = PathBuildRootA(path, j);
+ ok(root == path, "Expected root == path, got %p\n", root);
+ ok(!lstrcmp(root, root_expected[j]), "Expected %s, got %s\n", root_expected[j], root);
+ ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
+ }
+
+ /* test a negative drive number */
+ SetLastError(0xdeadbeef);
+ lstrcpy(path, "aaaaaaaaa");
+ root = PathBuildRootA(path, -1);
+ ok(root == path, "Expected root == path, got %p\n", root);
+ ok(!lstrcmp(path, "aaaaaaaaa"), "Expected aaaaaaaaa, got %s\n", path);
+ ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
+
+ /* test a drive number greater than 25 */
+ SetLastError(0xdeadbeef);
+ lstrcpy(path, "aaaaaaaaa");
+ root = PathBuildRootA(path, 26);
+ ok(root == path, "Expected root == path, got %p\n", root);
+ ok(!lstrcmp(path, "aaaaaaaaa"), "Expected aaaaaaaaa, got %s\n", path);
+ ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
+
+ /* length of path is less than 4 */
+ SetLastError(0xdeadbeef);
+ lstrcpy(path, "aa");
+ root = PathBuildRootA(path, 0);
+ ok(root == path, "Expected root == path, got %p\n", root);
+ ok(!lstrcmp(path, "A:\\"), "Expected A:\\, got %s\n", path);
+ ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
+
+ /* path is NULL */
+ SetLastError(0xdeadbeef);
+ root = PathBuildRootA(NULL, 0);
+ ok(root == NULL, "Expected root == NULL, got %p\n", root);
+ ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
+}
+
START_TEST(path)
{
hShlwapi = LoadLibraryA("shlwapi.dll");
@@ -1527,4 +1581,5 @@ START_TEST(path)
test_PathAppendA();
test_PathCanonicalizeA();
test_PathFindExtensionA();
+ test_PathBuildRootA();
}
More information about the wine-cvs
mailing list