changeset 324:dd78bd0152af

- removal of never-adopted mini-test framework stub - test/plain: better output and cleanup - test/plain_c++: better output and re-enabled this calls for other platforms than windows (was disabled by mistake)
author Tassilo Philipp
date Thu, 21 Nov 2019 12:50:37 +0100
parents 6ffb6a00cf55
children 7fbfddd1c354
files test/common/test_framework.h test/plain/test_main.c test/plain/test_structs.c test/plain_c++/test_main.cc
diffstat 4 files changed, 176 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/test/common/test_framework.h	Sat Nov 16 00:15:58 2019 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-
- Package: dyncall
- Library: test
- File: test/common/test_framework.h
- Description: 
- License:
-
-   Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 
-                           Tassilo Philipp <tphilipp@potion-studios.com>
-
-   Permission to use, copy, modify, and distribute this software for any
-   purpose with or without fee is hereby granted, provided that the above
-   copyright notice and this permission notice appear in all copies.
-
-   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-*/
-
-
-
-// 2007-10-11
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-// Statement breaking into debugger (for various platforms). @@@add if defined, etc...
-#ifdef _WIN32
-# ifdef _MSC_VER
-#  define DC_TEST_BREAK __debugbreak
-# else
-#  include <windows.h>
-#  define DC_TEST_BREAK DebugBreak
-# endif
-#else
-# define DC_TEST_BREAK
-#endif
-
-// Test state - evaluates to false inside a test function if a test fails.
-#define DC_TEST_STATE				testFramework_state
-
-// Test functions defined by DC_DEFINE_TEST_FUNC_BEGIN and DC_DEFINE_TEST_FUNC_END pairs do come with
-// a default parameter used to pass a path to them specifying where to find external data needed to
-// run the tests (if desired). NULL by default. It can be queried by using DC_TEST_PATH.
-#define DC_TEST_PATH				testFramework_suitePath
-
-// Test a single expression - the expression must evaluate to true in order to succeed.
-// #define DC_TEST(exp)				{ TEST_STATE = TEST_STATE && (exp); if(!TEST_STATE) DC_TEST_BREAK(); }
-
-#include <assert.h>
-
-#define DC_TEST(exp)        assert(exp)
-// { if (! (exp) ) DC_TEST_BREAK(); }
-
-// Macros used to define a test functions.
-#define DC_DEFINE_TEST_FUNC_BEGIN(name)	/*static */int name(/*const char* DC_TEST_PATH=NULL*/) { /*@@@ add logging*/ int TEST_STATE = TRUE;
-#define DC_DEFINE_TEST_FUNC_END			/*@@@ add logging*/ return TEST_STATE; }
--- a/test/plain/test_main.c	Sat Nov 16 00:15:58 2019 +0100
+++ b/test/plain/test_main.c	Thu Nov 21 12:50:37 2019 +0100
@@ -3,10 +3,10 @@
  Package: dyncall
  Library: test
  File: test/plain/test_main.c
- Description: 
+ Description:
  License:
 
-   Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 
+   Copyright (c) 2007-2019 Daniel Adler <dadler@uni-goettingen.de>,
                            Tassilo Philipp <tphilipp@potion-studios.com>
 
    Permission to use, copy, modify, and distribute this software for any
@@ -26,18 +26,17 @@
 
 
 
-#include "../common/test_framework.h"
 #include "../../dyncall/dyncall.h"
 #include "../common/platformInit.h"
 #include "../common/platformInit.c" /* Impl. for functions only used in this translation unit */
 
 
-/* ------------------------------------------------------------------------- 
- * test: identity function calls 
+/* -------------------------------------------------------------------------
+ * test: identity function calls
  * ------------------------------------------------------------------------- */
 
 #define DEF_FUNCS(API,NAME) \
-void       API fun_##NAME##_v()             {           } \
+void       API fun_##NAME##_v()             { g_void_testval = 1; } \
 DCbool     API fun_##NAME##_b(DCbool x)     { return x; } \
 DCint      API fun_##NAME##_i(DCint x)      { return x; } \
 DClong     API fun_##NAME##_j(DClong x)     { return x; } \
@@ -49,32 +48,38 @@
 /* __cdecl */
 
 #if !defined(DC__OS_Win32)
-#  define __declspec(X)
 #  define __cdecl
 #endif
 
+int g_void_testval;
 DEF_FUNCS(__cdecl,c)
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallC)
+int testCallC()
+{
+  int ret = 1;
 
   DCCallVM* pc = dcNewCallVM(4096);
   dcMode(pc,DC_CALL_C_DEFAULT);
   /* void */
   dcReset(pc);
+  g_void_testval = 0;
   dcCallVoid(pc, (DCpointer) &fun_c_v);
+  ret = g_void_testval && ret;
   /* bool */
   {
-    DCbool r, val=DC_TRUE; 
+    DCbool r, val=DC_TRUE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_c_b);
-    DC_TEST(r == val);
+    printf("bt (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
 
     val=DC_FALSE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_c_b);
-    DC_TEST(r == val);
+    printf("bf (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* int */
   {
@@ -82,7 +87,8 @@
     dcReset(pc);
     dcArgInt(pc, val);
     r = dcCallInt(pc, (DCpointer) &fun_c_i);
-    DC_TEST(r == val);
+    printf("i  (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long */
   {
@@ -90,7 +96,8 @@
     dcReset(pc);
     dcArgLong(pc, val);
     r = dcCallLong(pc, (DCpointer) &fun_c_j);
-    DC_TEST(r == val);
+    printf("l  (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long long */
   {
@@ -98,7 +105,8 @@
     dcReset(pc);
     dcArgLongLong(pc, val);
     r = dcCallLongLong(pc, (DCpointer) &fun_c_l);
-    DC_TEST(r == (DClonglong)val);
+    printf("ll (cdecl): %d\n", (r == (DClonglong)val));
+	ret = (r == (DClonglong)val) && ret;
   }
   /* float */
   {
@@ -106,7 +114,8 @@
     dcReset(pc);
     dcArgFloat(pc, val);
     r = dcCallFloat(pc, (DCpointer) &fun_c_f);
-    DC_TEST(r == val);
+    printf("f  (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* double */
   {
@@ -114,7 +123,8 @@
     dcReset(pc);
     dcArgDouble(pc, val);
     r = dcCallDouble(pc, (DCpointer) &fun_c_d);
-    DC_TEST(r == val);
+    printf("d  (cdecl): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* ptr */
   {
@@ -122,11 +132,13 @@
     dcReset(pc);
     dcArgPointer(pc, (DCpointer) &fun_c_b);
     r = dcCallPointer(pc, (DCpointer) &fun_c_p);
-    DC_TEST(r == (DCpointer) &fun_c_b);
+    printf("p  (cdecl): %d\n", (r == (DCpointer) &fun_c_b));
+	ret = (r == (DCpointer) &fun_c_b) && ret;
   }
   dcFree(pc);
 
-DC_DEFINE_TEST_FUNC_END
+  return ret;
+}
 
 
 #ifdef DC__OS_Win32
@@ -134,26 +146,32 @@
 
 DEF_FUNCS(__stdcall,std)
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallStd)
+int testCallStd()
+{
+  int ret = 1;
 
   DCCallVM* pc = dcNewCallVM(4096);
   dcMode(pc,DC_CALL_C_X86_WIN32_STD);
   /* void */
   dcReset(pc);
+  g_void_testval = 0;
   dcCallVoid(pc, (DCpointer) &fun_std_v);
+  ret = g_void_testval && ret;
   /* bool */
   {
     DCbool r, val=DC_TRUE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_std_b);
-    DC_TEST(r == val);
+    printf("bt (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
 
     val=DC_FALSE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_std_b);
-    DC_TEST(r == val);
+    printf("bf (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* int */
   {
@@ -161,7 +179,8 @@
     dcReset(pc);
     dcArgInt(pc, val);
     r = dcCallInt(pc, (DCpointer) &fun_std_i);
-    DC_TEST(r == val);
+    printf("i  (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long */
   {
@@ -169,7 +188,8 @@
     dcReset(pc);
     dcArgLong(pc, val);
     r = dcCallLong(pc, (DCpointer) &fun_std_j);
-    DC_TEST(r == val);
+    printf("l  (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long long */
   {
@@ -177,7 +197,8 @@
     dcReset(pc);
     dcArgLongLong(pc, val);
     r = dcCallLongLong(pc, (DCpointer) &fun_std_l);
-    DC_TEST(r == val);
+    printf("ll (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* float */
   {
@@ -185,7 +206,8 @@
     dcReset(pc);
     dcArgFloat(pc, val);
     r = dcCallFloat(pc, (DCpointer) &fun_std_f);
-    DC_TEST(r == val);
+    printf("f  (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* double */
   {
@@ -193,7 +215,8 @@
     dcReset(pc);
     dcArgDouble(pc, val);
     r = dcCallDouble(pc, (DCpointer) &fun_std_d);
-    DC_TEST(r == val);
+    printf("d  (stdcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* ptr */
   {
@@ -201,11 +224,13 @@
     dcReset(pc);
     dcArgPointer(pc, (DCpointer) &fun_c_b);
     r = dcCallPointer(pc, (DCpointer) &fun_std_p);
-    DC_TEST(r == &fun_c_b);
+    printf("p  (stdcall): %d\n", (r == &fun_c_b));
+	ret = (r == &fun_c_b) && ret;
   }
   dcFree(pc);
 
-DC_DEFINE_TEST_FUNC_END
+  return ret;
+}
 
 #endif
 
@@ -215,30 +240,38 @@
 
 DEF_FUNCS(__fastcall,fast)
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallFast)
+int testCallFast()
+{
+  int ret = 1;
 
   DCCallVM* pc = dcNewCallVM(4096);
 #ifdef DC__C_GNU
+# define FT "GNU"
   dcMode(pc,DC_CALL_C_X86_WIN32_FAST_GNU);
 #else
+# define FT "MS"
   dcMode(pc,DC_CALL_C_X86_WIN32_FAST_MS);
 #endif
   /* void */
   dcReset(pc);
+  g_void_testval = 0;
   dcCallVoid(pc, (DCpointer) &fun_fast_v);
+  ret = g_void_testval && ret;
   /* bool */
   {
     DCbool r, val=DC_TRUE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_fast_b);
-    DC_TEST(r == val);
+    printf("bt ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
 
     val=DC_FALSE;
     dcReset(pc);
     dcArgBool(pc, val);
     r = dcCallBool(pc, (DCpointer) &fun_fast_b);
-    DC_TEST(r == val);
+    printf("bf ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* int */
   {
@@ -246,7 +279,8 @@
     dcReset(pc);
     dcArgInt(pc, val);
     r = dcCallInt(pc, (DCpointer) &fun_fast_i);
-    DC_TEST(r == val);
+    printf("i  ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long */
   {
@@ -254,7 +288,8 @@
     dcReset(pc);
     dcArgLong(pc, val);
     r = dcCallLong(pc, (DCpointer) &fun_fast_j);
-    DC_TEST(r == val);
+    printf("l  ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* long long */
   {
@@ -262,7 +297,8 @@
     dcReset(pc);
     dcArgLongLong(pc, val);
     r = dcCallLongLong(pc, (DCpointer) &fun_fast_l);
-    DC_TEST(r == val);
+    printf("ll ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* float */
   {
@@ -270,7 +306,8 @@
     dcReset(pc);
     dcArgFloat(pc, val);
     r = dcCallFloat(pc, (DCpointer) &fun_fast_f);
-    DC_TEST(r == val);
+    printf("f  ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* double */
   {
@@ -278,7 +315,8 @@
     dcReset(pc);
     dcArgDouble(pc, val);
     r = dcCallDouble(pc, (DCpointer) &fun_fast_d);
-    DC_TEST(r == val);
+    printf("d  ("FT"fastcall): %d\n", (r == val));
+	ret = (r == val) && ret;
   }
   /* ptr */
   {
@@ -286,47 +324,37 @@
     dcReset(pc);
     dcArgPointer(pc, (DCpointer) &fun_c_b);
     r = dcCallPointer(pc, (DCpointer) &fun_fast_p);
-    DC_TEST(r == &fun_c_b);
+    printf("p  ("FT"fastcall): %d\n", (r == &fun_c_b));
+	ret = (r == &fun_c_b) && ret;
   }
   dcFree(pc);
 
-DC_DEFINE_TEST_FUNC_END
+  return ret;
+}
+
 #endif
 
+
 int testCallStructs();
 int testStructSizes();
+
 int main(int argc, char* argv[])
 {
-  int b = TRUE;
+  int r = 1;
   dcTest_initPlatform();
-  
-  b = b && testCallC();
-  printf("C:%d\n",b);
-
-  b = b && testStructSizes();
-  printf("Struct Sizes:%d\n",b);
 
-  /*b = b && testCallStructs();
-  printf("Call Structs:%d\n",b);*/
-
+  r = testCallC() && r;
+  r = testStructSizes() && r;
+  /*r = testCallStructs() && r;*/
 #if defined(DC__OS_Win32)
-  
-  b = b && testCallStd();
-  printf("Std:%d\n",b);
-
-  b = b && testCallFast();
-#ifdef DC__C_GNU
-  printf("FastGNU:%d\n",b);
-#else
-  printf("FastMS:%d\n",b);
+  r = testCallStd() && r;
+  r = testCallFast() && r;
 #endif
 
-#endif
-
-  printf("result: plain: %d\n", b);
+  printf("result: plain: %d\n", r);
 
   dcTest_deInitPlatform();
 
-  return !b;
+  return !r;
 }
 
--- a/test/plain/test_structs.c	Sat Nov 16 00:15:58 2019 +0100
+++ b/test/plain/test_structs.c	Thu Nov 21 12:50:37 2019 +0100
@@ -3,10 +3,11 @@
  Package: dyncall
  Library: test
  File: test/plain/test_structs.c
- Description: 
+ Description:
  License:
 
    Copyright (c) 2010-2015 Olivier Chafik <olivier.chafik@gmail.com>
+                      2019 Tassilo Philipp <tphilipp@potion-studios.com>
 
    Permission to use, copy, modify, and distribute this software for any
    purpose with or without fee is hereby granted, provided that the above
@@ -25,7 +26,6 @@
 
 
 
-#include "../common/test_framework.h"
 #include "../../dyncall/dyncall.h"
 #include "../../dyncall/dyncall_signature.h"
 #include "../../dyncall/dyncall_struct.h"
@@ -34,14 +34,16 @@
 #define DC_TEST_INT_EQUAL(expected, computed) { \
 	if (expected != computed) \
 		printf("expected = %d, computed = %d\n\n", (int)expected, (int)computed); \
-	DC_TEST(expected == computed); \
+	ret = (expected == computed) && ret; \
 }
 #define DC_TEST_STRUCT_SIZE(type, s) { \
 	DCsize expected = sizeof(type), computed = dcStructSize(s);\
 	DC_TEST_INT_EQUAL(expected, computed); \
 }
 
-DC_DEFINE_TEST_FUNC_BEGIN(testStructSizes)
+int testStructSizes()
+{
+	int ret = 1;
 
 	{
 		typedef struct {
@@ -128,7 +130,8 @@
 	TEST_MONO_STRUCT(float,              DC_SIGCHAR_FLOAT);
 	TEST_MONO_STRUCT(double,             DC_SIGCHAR_DOUBLE);
 
-DC_DEFINE_TEST_FUNC_END
+	return ret;
+}
 
 
 
@@ -156,7 +159,9 @@
 }
 
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallStructs)
+int testCallStructs()
+{
+	int ret = 1;
 
 	DCCallVM* pc = dcNewCallVM(4096);
 	{
@@ -214,5 +219,6 @@
 
 	dcFree(pc);
 
-DC_DEFINE_TEST_FUNC_END
+	return ret;
+}
 
--- a/test/plain_c++/test_main.cc	Sat Nov 16 00:15:58 2019 +0100
+++ b/test/plain_c++/test_main.cc	Thu Nov 21 12:50:37 2019 +0100
@@ -3,10 +3,10 @@
  Package: dyncall
  Library: test
  File: test/plain_c++/test_main.cc
- Description: 
+ Description:
  License:
 
-   Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 
+   Copyright (c) 2007-2019 Daniel Adler <dadler@uni-goettingen.de>,
                            Tassilo Philipp <tphilipp@potion-studios.com>
 
    Permission to use, copy, modify, and distribute this software for any
@@ -26,14 +26,25 @@
 
 
 
-#include "../common/test_framework.h"
 #include "../../dyncall/dyncall.h"
 #include "../common/platformInit.h"
 #include "../common/platformInit.c" /* Impl. for functions only used in this translation unit */
 
 
-/* ------------------------------------------------------------------------- 
- * test: identity function calls 
+#include <signal.h>
+#include <setjmp.h>
+
+jmp_buf jbuf;
+
+
+void segv_handler(int sig)
+{
+  longjmp(jbuf, 1);
+}
+
+
+/* -------------------------------------------------------------------------
+ * test: identity function calls
  * ------------------------------------------------------------------------- */
 
 #define DEF_FUNCS(API,NAME) \
@@ -49,13 +60,12 @@
 /* __cdecl */
 
 #if !defined(DC__OS_Win32)
-#  define __declspec(X)
 #  define __cdecl
 #endif
 
 
-/* ------------------------------------------------------------------------- 
- * test: identity this calls 
+/* -------------------------------------------------------------------------
+ * test: identity this calls
  * ------------------------------------------------------------------------- */
 
 union ValueUnion
@@ -75,7 +85,7 @@
 
 /*
  * the layout of the VTable is non-standard and it is not clear what is the initial real first method index.
- * so for it turns out that: 
+ * so far it turns out that:
  * on vc/x86  : 1
  * on GCC/x86 : 2
  */
@@ -150,8 +160,9 @@
 };
 
 template<typename T>
-void testCallValue(DCCallVM* pc)
+bool testCallValue(DCCallVM* pc, const char* name)
 {
+  bool r = true, b;
   T o;
   T* pThis = &o;
   DCpointer* vtbl =  *( (DCpointer**) pThis ); /* vtbl is located at beginning of class */
@@ -164,7 +175,10 @@
   dcCallVoid(pc, vtbl[VTBI_SET_BOOL] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_TRUE );
+  b = ( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_TRUE );
+  printf("bt (%s): %d\n", name, b);
+  r = r && b;
+
   /* set/get bool (FALSE) */
 
   dcReset(pc);
@@ -173,7 +187,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_BOOL] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_FALSE );
+  b = ( dcCallBool(pc, vtbl[VTBI_GET_BOOL] ) == DC_FALSE );
+  printf("bf (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get int */
 
@@ -183,7 +199,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_INT] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallInt(pc, vtbl[VTBI_GET_INT] ) == 1234 );
+  b = ( dcCallInt(pc, vtbl[VTBI_GET_INT] ) == 1234 );
+  printf("i  (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get long */
 
@@ -193,7 +211,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_LONG] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallLong(pc, vtbl[VTBI_GET_LONG] ) == (DClong)0xCAFEBABEUL );
+  b = ( dcCallLong(pc, vtbl[VTBI_GET_LONG] ) == (DClong)0xCAFEBABEUL );
+  printf("l  (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get long long */
 
@@ -203,7 +223,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_LONG_LONG] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallLongLong(pc, vtbl[VTBI_GET_LONG_LONG] ) == (DClonglong)0xCAFEBABEDEADC0DELL );
+  b = ( dcCallLongLong(pc, vtbl[VTBI_GET_LONG_LONG] ) == (DClonglong)0xCAFEBABEDEADC0DELL );
+  printf("ll (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get float */
 
@@ -213,7 +235,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_FLOAT] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallFloat(pc, vtbl[VTBI_GET_FLOAT] ) == 1.2345f );
+  b = ( dcCallFloat(pc, vtbl[VTBI_GET_FLOAT] ) == 1.2345f );
+  printf("f  (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get double */
 
@@ -223,7 +247,9 @@
   dcCallVoid(pc, vtbl[VTBI_SET_DOUBLE] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallDouble(pc, vtbl[VTBI_GET_DOUBLE] ) == 1.23456789 );
+  b = ( dcCallDouble(pc, vtbl[VTBI_GET_DOUBLE] ) == 1.23456789 );
+  printf("d  (%s): %d\n", name, b);
+  r = r && b;
 
   /* set/get pointer */
 
@@ -233,33 +259,45 @@
   dcCallVoid(pc, vtbl[VTBI_SET_POINTER] );
   dcReset(pc);
   dcArgPointer(pc, pThis);
-  DC_TEST( dcCallPointer(pc, vtbl[VTBI_GET_POINTER] ) == ( (DCpointer) 0xCAFEBABE ) );
+  b = ( dcCallPointer(pc, vtbl[VTBI_GET_POINTER] ) == ( (DCpointer) 0xCAFEBABE ) );
+  printf("p  (%s): %d\n", name, b);
+  r = r && b;
+
+  return r;
 }
 
 
 #ifdef DC__OS_Win32
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallThisMS)
-
+int testCallThisMS()
+{
+  bool r = false;
   DCCallVM* pc = dcNewCallVM(4096);
-  dcMode(pc,DC_CALL_C_X86_WIN32_THIS_MS);
+  dcMode(pc, DC_CALL_C_X86_WIN32_THIS_MS);
   dcReset(pc);
-  testCallValue<ValueMS>(pc); 
+  if(setjmp(jbuf) != 0)
+    printf("sigsegv\n");
+  else
+    r = testCallValue<ValueMS>(pc, "MS");
   dcFree(pc);
-
-DC_DEFINE_TEST_FUNC_END
+  return r;
+}
 
 #endif
 
 
-DC_DEFINE_TEST_FUNC_BEGIN(testCallThisC)
-
+int testCallThisC()
+{
+  bool r = false;
   DCCallVM* pc = dcNewCallVM(4096);
   dcReset(pc);
-  testCallValue<Value>(pc); 
+  if(setjmp(jbuf) != 0)
+    printf("sigsegv\n");
+  else
+    r = testCallValue<Value>(pc, "c");
   dcFree(pc);
-
-DC_DEFINE_TEST_FUNC_END
+  return r;
+}
 
 
 extern "C" {
@@ -268,25 +306,20 @@
 {
   dcTest_initPlatform();
 
-  int b = TRUE;
-  
-#if defined(DC__OS_Win32)	// ThisCall temporarily only for win 32 @@@
-  
-  b = b && testCallThisC();
-  printf("ThisC:%d\n",b);
+  signal(SIGSEGV, segv_handler);
+
+  bool r = true;
 
+  r = testCallThisC() && r;
 #if defined(DC__C_MSVC)
-  b = b && testCallThisMS();
-  printf("ThisMS:%d\n",b);
+  r = testCallThisMS() && r;
 #endif
 
-#endif
-
-  printf("result: plain_cpp: %d\n", b);
+  printf("result: plain_cpp: %d\n", r);
 
   dcTest_deInitPlatform();
 
-  return !b;
+  return !r;
 }
 
 }  // extern "C"