Mercurial > pub > dyncall > dyncall
diff test/suite_x86win32fast/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 | d73dc7ad37e4 |
line wrap: on
line diff
--- a/test/suite_x86win32fast/main.cc Sun Oct 03 19:41:41 2021 +0200 +++ b/test/suite_x86win32fast/main.cc Tue Oct 05 21:53:04 2021 +0200 @@ -3,10 +3,10 @@ Package: dyncall Library: test File: test/suite_x86win32fast/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 @@ -80,13 +80,13 @@ valueDouble[i] = DCdouble(i); valuePointer[i] = DCpointer(i); valueFloat[i] = DCfloat(i); - } + } } void push(DCCallVM* pCall, int select, int pos) { - switch(select) + switch(select) { case 0: dcArgBool( pCall, valueBool[pos] ); break; case 1: dcArgInt( pCall, valueInt[pos] ); break; @@ -98,7 +98,7 @@ } -#define assert(x) if (!(x)) return false +#define test(x) if (!(x)) return false bool test(int x) @@ -116,21 +116,21 @@ int y = x; int selects[NARGS] = { 0, }; int pos = 0; - for(pos = 0;y>0;++pos) + for(pos = 0;y>0;++pos) { - int select = (y-1) % NTYPES; + int select = (y-1) % NTYPES; selects[pos] = select; push(pCall,select,pos); y = (y-1) / NTYPES; } dcCallVoid(pCall,getFunc(x)); - - assert( getId() == x ); - + + test( getId() == x ); + for(int i = 0;i<pos;++i) { - assert( equals( selects[i], i, getArg(i) ) ); + test( equals( selects[i], i, getArg(i) ) ); } - + dcFree(pCall); return true; } @@ -167,7 +167,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; @@ -176,12 +176,12 @@ int ncalls = powerfact(NTYPES,NARGS)+1; success = run_range(0,ncalls); } - - printf("result: suite_x86win32fast: %s\n", success ? "1" : "0"); + + printf("result: suite_x86win32fast: %d\n", success); dcTest_deInitPlatform(); - return (success) ? 0 : -1; + return !success; } } // extern "C"