[PSEH2_TEST}
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 5 Apr 2014 14:24:16 +0000 (14:24 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 5 Apr 2014 14:24:16 +0000 (14:24 +0000)
Use the tests with C++, too.

svn path=/trunk/; revision=62620

rostests/tests/pseh2/CMakeLists.txt
rostests/tests/pseh2/psehtest.c
rostests/tests/pseh2/psehtest_cpp.cpp [new file with mode: 0644]

index 38b627f..6c551df 100644 (file)
@@ -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()
index 66cd6e5..e23dc73 100644 (file)
 
 #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),
diff --git a/rostests/tests/pseh2/psehtest_cpp.cpp b/rostests/tests/pseh2/psehtest_cpp.cpp
new file mode 100644 (file)
index 0000000..d6fe2e5
--- /dev/null
@@ -0,0 +1,3 @@
+
+
+#include "psehtest.c"