diff test/suite2/main.cc @ 410:7608e34098b0

- cleanups, simplifications, some api clarification, ... - test cases consistency: * return status code depending on test results (for actual conformance tests, not stuff that is not an example or hack to check something, ..) * platform init helper added for some
author Tassilo Philipp
date Tue, 05 Oct 2021 21:53:04 +0200
parents f5577f6bf97a
children 0f40e13a2f0a
line wrap: on
line diff
--- a/test/suite2/main.cc	Sun Oct 03 19:41:41 2021 +0200
+++ b/test/suite2/main.cc	Tue Oct 05 21:53:04 2021 +0200
@@ -3,10 +3,10 @@
  Package: dyncall
  Library: test
  File: test/suite2/main.cc
- Description: 
+ Description:
  License:
 
-   Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 
+   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
@@ -88,12 +88,12 @@
   const DCsigchar* ptr = sig;
   DCsigchar ch;
   int pos;
- 
+
   pos = 0;
 
   pCall = dcNewCallVM(4096);
   dcReset(pCall);
- 
+
   while ( (ch=*ptr++) != '\0' ) {
     switch(ch) {
       case DC_SIGCHAR_BOOL:     dcArgBool    ( pCall, valueBool    [pos] ); break;
@@ -111,8 +111,8 @@
 
   dcCallVoid( pCall, fi->funcptr );
 
- 
-  if ( getId() == x ) { 
+
+  if ( getId() == x ) {
 
     ptr = sig;
     pos = 0;
@@ -137,7 +137,7 @@
   }
 
   printf("%d-%s:%d\n", x, sig, r);
-   
+
   dcFree(pCall);
 
   return r;
@@ -162,7 +162,7 @@
   init();
   if (argc == 2) {
     int index = atoi(argv[1]);
-    success = run_range( index, index+1 ); 
+    success = run_range( index, index+1 );
   } else if (argc == 3) {
     int from = atoi(argv[1]);
     int to   = atoi(argv[2])+1;
@@ -171,11 +171,11 @@
     success = run_range(0,NCASES);
   }
 
-  printf("result: suite2: %s\n", success ? "1" : "0");
+  printf("result: suite2: %d\n", success);
 
   dcTest_deInitPlatform();
 
-  return (success) ? 0 : -1;
+  return !success;
 }
 
 }  // extern "C"