2 * PROJECT: ReactOS Spooler Router API Tests
3 * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
4 * PURPOSE: Tests for ReallocSplStr
5 * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
10 #define WIN32_NO_STATUS
15 START_TEST(ReallocSplStr
)
17 const WCHAR wszTestString1
[] = L
"Test";
18 const WCHAR wszTestString2
[] = L
"New";
24 // Verify that ReallocSplStr raises an exception if all parameters are NULL.
28 ReallocSplStr(NULL
, NULL
);
30 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
32 dwResult
= _SEH2_GetExceptionCode();
36 ok(dwResult
== EXCEPTION_ACCESS_VIOLATION
, "dwResult is %lx!\n", dwResult
);
38 // Allocate a string for testing.
39 pwszTest
= AllocSplStr(wszTestString1
);
42 skip("AllocSplStr failed with error %lu!\n", GetLastError());
46 // Verify that ReallocSplStr frees the old string even if pwszInput is NULL.
47 ok(ReallocSplStr(&pwszTest
, NULL
), "ReallocSplStr is FALSE!\n");
48 ok(pwszTest
== NULL
, "pwszTest is %p\n", pwszTest
);
50 // Now verify that ReallocSplStr copies the new string into a new block and frees the old one.
51 pwszBackup
= pwszTest
;
52 ok(ReallocSplStr(&pwszTest
, wszTestString2
), "ReallocSplStr is FALSE!\n");
53 ok(wcscmp(pwszTest
, wszTestString2
) == 0, "New string was not copied into pwszTest!\n");
57 dwResult
= (DWORD
)wcscmp(pwszBackup
, wszTestString1
);
59 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
61 dwResult
= _SEH2_GetExceptionCode();
65 ok(dwResult
== EXCEPTION_ACCESS_VIOLATION
, "dwResult is %lx!\n", dwResult
);