Module: wine Branch: master Commit: c43bac44ba261cb730da05df54b059aea6afc981 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c43bac44ba261cb730da05df54...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Sun Jul 18 19:33:27 2010 -0500
shlwapi/tests: Add tests for StrStrA.
---
dlls/shlwapi/tests/string.c | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c index b8cf7e0..a4e8d45 100644 --- a/dlls/shlwapi/tests/string.c +++ b/dlls/shlwapi/tests/string.c @@ -960,6 +960,53 @@ if (0) win_skip("wnsprintfW() is not available\n"); }
+static void test_StrStrA(void) +{ + static const char *deadbeef = "DeAdBeEf"; + + const struct + { + const char *search; + const char *expect; + } StrStrA_cases[] = + { + {"", NULL}, + {"DeAd", deadbeef}, + {"dead", NULL}, + {"AdBe", deadbeef + 2}, + {"adbe", NULL}, + {"BeEf", deadbeef + 4}, + {"beef", NULL}, + }; + + LPSTR ret; + int i; + + /* Tests crash on Win9x/Win2k. */ + if (0) + { + ret = StrStrA(NULL, NULL); + ok(!ret, "Expected StrStrA to return NULL, got %p\n", ret); + + ret = StrStrA(NULL, ""); + ok(!ret, "Expected StrStrA to return NULL, got %p\n", ret); + + ret = StrStrA("", NULL); + ok(!ret, "Expected StrStrA to return NULL, got %p\n", ret); + } + + ret = StrStrA("", ""); + ok(!ret, "Expected StrStrA to return NULL, got %p\n", ret); + + for (i = 0; i < sizeof(StrStrA_cases)/sizeof(StrStrA_cases[0]); i++) + { + ret = StrStrA(deadbeef, StrStrA_cases[i].search); + ok(ret == StrStrA_cases[i].expect, + "[%d] Expected StrStrA to return %p, got %p\n", + i, StrStrA_cases[i].expect, ret); + } +} + START_TEST(string) { HMODULE hShlwapi; @@ -1029,6 +1076,7 @@ START_TEST(string) test_SHAnsiToAnsi(); test_SHUnicodeToUnicode(); test_StrXXX_overflows(); + test_StrStrA();
CoUninitialize(); }