mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 16:51:18 +00:00
[PSEH2_TEST}
Use the tests with C++, too. svn path=/trunk/; revision=62620
This commit is contained in:
parent
34eddff2f1
commit
2afcfa6dbd
3 changed files with 43 additions and 1 deletions
|
@ -8,3 +8,14 @@ add_cd_file(TARGET pseh2_test DESTINATION reactos/bin FOR all)
|
|||
if(NOT MSVC)
|
||||
add_target_compile_flags(pseh2_test "-Wno-format")
|
||||
endif()
|
||||
|
||||
|
||||
add_executable(pseh2_test_cpp psehtest_cpp.cpp psehtest2.c)
|
||||
target_link_libraries(pseh2_test_cpp wine ${PSEH_LIB})
|
||||
set_module_type(pseh2_test_cpp win32cui)
|
||||
add_importlibs(pseh2_test_cpp msvcrt kernel32 ntdll)
|
||||
add_cd_file(TARGET pseh2_test_cpp DESTINATION reactos/bin FOR all)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_target_compile_flags(pseh2_test_cpp "-Wno-format")
|
||||
endif()
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define STANDALONE
|
||||
#include <wine/test.h>
|
||||
|
||||
|
@ -54,7 +58,11 @@ extern int return_minusone_4(void *, int);
|
|||
|
||||
extern void set_positive(int *);
|
||||
|
||||
static int call_test(int (*)(void));
|
||||
//static int call_test(int (*)(void));
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#define DEFINE_TEST(NAME_) static int NAME_(void)
|
||||
|
||||
|
@ -2487,6 +2495,25 @@ DEFINE_TEST(test_unvolatile_3)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_unvolatile_4)
|
||||
{
|
||||
unsigned result = 0xdeadbeef;
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
*(char*)0x80000000 = 1;
|
||||
}
|
||||
_SEH2_EXCEPT(result == 0xdeadbeef)
|
||||
{
|
||||
result = 2;
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
result = (result == 0xdeadbeef) ? 0 : result + 1;
|
||||
|
||||
return result == 3;
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_finally_goto)
|
||||
{
|
||||
volatile int val = 0;
|
||||
|
@ -2814,6 +2841,7 @@ void testsuite_syntax(void)
|
|||
USE_TEST(test_unvolatile),
|
||||
USE_TEST(test_unvolatile_2),
|
||||
USE_TEST(test_unvolatile_3),
|
||||
USE_TEST(test_unvolatile_4),
|
||||
USE_TEST(test_finally_goto),
|
||||
USE_TEST(test_nested_exception),
|
||||
USE_TEST(test_PSEH3_bug),
|
||||
|
|
3
rostests/tests/pseh2/psehtest_cpp.cpp
Normal file
3
rostests/tests/pseh2/psehtest_cpp.cpp
Normal file
|
@ -0,0 +1,3 @@
|
|||
|
||||
|
||||
#include "psehtest.c"
|
Loading…
Reference in a new issue