From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/ntdll/tests/rtl.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index b2e2052a2d4..9abe0d2e9cc 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -118,6 +118,7 @@ static NTSTATUS (WINAPI *pRtlInitializeNtUserPfn)( const UINT64 *client_procsA, const UINT64 *client_procsW, ULONG procsW_size, const void *client_workers, ULONG workers_size ); static PRTL_SPLAY_LINKS (WINAPI *pRtlRealPredecessor)(PRTL_SPLAY_LINKS); +static PRTL_SPLAY_LINKS (WINAPI *pRtlRealSuccessor)(PRTL_SPLAY_LINKS); static NTSTATUS (WINAPI *pRtlRetrieveNtUserPfn)( const UINT64 **client_procsA, const UINT64 **client_procsW, const UINT64 **client_workers ); @@ -173,6 +174,7 @@ static void InitFunctionPtrs(void) pRtlConvertDeviceFamilyInfoToString = (void *)GetProcAddress(hntdll, "RtlConvertDeviceFamilyInfoToString"); pRtlInitializeNtUserPfn = (void *)GetProcAddress(hntdll, "RtlInitializeNtUserPfn"); pRtlRealPredecessor = (void *)GetProcAddress(hntdll, "RtlRealPredecessor"); + pRtlRealSuccessor = (void *)GetProcAddress(hntdll, "RtlRealSuccessor"); pRtlRetrieveNtUserPfn = (void *)GetProcAddress(hntdll, "RtlRetrieveNtUserPfn"); pRtlResetNtUserPfn = (void *)GetProcAddress(hntdll, "RtlResetNtUserPfn"); pRtlSubtreePredecessor = (void *)GetProcAddress(hntdll, "RtlSubtreePredecessor"); @@ -4219,6 +4221,46 @@ static void test_RtlRealPredecessor(void) } }
+static void test_RtlRealSuccessor(void) +{ + /* 3 + * / \ + * 1 5 + * / \ / \ + * 0 2 4 6 + */ + static const struct splay_index splay_indices[] = + { + {3, 1, 5}, + {1, 0, 2}, + {5, 4, 6}, + }; + static const int expected_successors[] = {1, 2, 3, 4, 5, 6, -1}; + RTL_SPLAY_LINKS links[7], *successor; + unsigned int i; + + if (!pRtlRealSuccessor) + { + win_skip("RtlRealSuccessor is unavailable.\n"); + return; + } + + init_splay_indices(links, ARRAY_SIZE(links), splay_indices, ARRAY_SIZE(splay_indices)); + for (i = 0; i < ARRAY_SIZE(expected_successors); i++) + { + winetest_push_context("%d", i); + + successor = pRtlRealSuccessor(&links[i]); + if (expected_successors[i] == -1) + ok(!successor, "Expected NULL, got unexpected %d.\n", (int)(successor - links)); + else + ok(successor == &links[expected_successors[i]], "Expected %d, got unexpected %d.\n", + expected_successors[i], (int)(successor ? successor - links : -1)); + + winetest_pop_context(); + } +} + START_TEST(rtl) { InitFunctionPtrs(); @@ -4274,4 +4316,5 @@ START_TEST(rtl) test_RtlSubtreePredecessor(); test_RtlSubtreeSuccessor(); test_RtlRealPredecessor(); + test_RtlRealSuccessor(); }