# HG changeset patch # User Tassilo Philipp # Date 1643193477 -3600 # Node ID 23b12c7ad462d97a532f76078f5a2493e63623a2 # Parent a29baee6834023768f9674977e361006886ba0d7 - call_suite cleanup (no change in functionality): removal of unused decl, freeing memory at end, func renaming for clarity, static for tu-local symbols, ... diff -r a29baee68340 -r 23b12c7ad462 test/call_suite/globals.c --- a/test/call_suite/globals.c Mon Jan 24 12:41:27 2022 +0100 +++ b/test/call_suite/globals.c Wed Jan 26 11:37:57 2022 +0100 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2011-2018 Daniel Adler , + Copyright (c) 2011-2022 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -31,9 +31,9 @@ DEF_TYPES #undef X -double rand_d() { return ( ( (double) rand() ) / ( (double) RAND_MAX ) ); } +static double rand_d() { return ( ( (double) rand() ) / ( (double) RAND_MAX ) ); } -void init_K() +void init_test_data() { int i; #define X(CH,T) V_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); K_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); @@ -61,3 +61,9 @@ } } +void deinit_test_data() +{ +#define X(CH,T) free(V_##CH); free(K_##CH); +DEF_TYPES +#undef X +} diff -r a29baee68340 -r 23b12c7ad462 test/call_suite/globals.h --- a/test/call_suite/globals.h Mon Jan 24 12:41:27 2022 +0100 +++ b/test/call_suite/globals.h Wed Jan 26 11:37:57 2022 +0100 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2011-2018 Daniel Adler , + Copyright (c) 2011-2022 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -37,7 +37,7 @@ extern int G_ncases; extern int G_maxargs; -void init_K(); -void init_T(); +void init_test_data(); +void deinit_test_data(); void clear_V(); diff -r a29baee68340 -r 23b12c7ad462 test/call_suite/main.c --- a/test/call_suite/main.c Mon Jan 24 12:41:27 2022 +0100 +++ b/test/call_suite/main.c Wed Jan 26 11:37:57 2022 +0100 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2011-2018 Daniel Adler , + Copyright (c) 2011-2022 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -33,7 +33,7 @@ void* G_callvm; -int invoke(char const* signature, void* t) +static int invoke(char const* signature, void* t) { DCCallVM * p = (DCCallVM*) G_callvm; char const * sig = signature; @@ -82,14 +82,14 @@ pos = 1; while ( (atype = *sig++) != '\0') { switch(atype) { - case 'c': s = ( V_c[pos] == K_c[pos] ); if (!s) printf("'c':%d: %d != %d ; ", pos, V_c[pos], K_c[pos]); break; - case 's': s = ( V_s[pos] == K_s[pos] ); if (!s) printf("'s':%d: %d != %d ; ", pos, V_s[pos], K_s[pos]); break; - case 'i': s = ( V_i[pos] == K_i[pos] ); if (!s) printf("'i':%d: %d != %d ; ", pos, V_i[pos], K_i[pos]); break; - case 'j': s = ( V_j[pos] == K_j[pos] ); if (!s) printf("'j':%d: %ld != %ld ; ", pos, V_j[pos], K_j[pos]); break; + case 'c': s = ( V_c[pos] == K_c[pos] ); if (!s) printf("'c':%d: %d != %d ; ", pos, V_c[pos], K_c[pos]); break; + case 's': s = ( V_s[pos] == K_s[pos] ); if (!s) printf("'s':%d: %d != %d ; ", pos, V_s[pos], K_s[pos]); break; + case 'i': s = ( V_i[pos] == K_i[pos] ); if (!s) printf("'i':%d: %d != %d ; ", pos, V_i[pos], K_i[pos]); break; + case 'j': s = ( V_j[pos] == K_j[pos] ); if (!s) printf("'j':%d: %ld != %ld ; ", pos, V_j[pos], K_j[pos]); break; case 'l': s = ( V_l[pos] == K_l[pos] ); if (!s) printf("'l':%d: %lld != %lld ; ", pos, V_l[pos], K_l[pos]); break; - case 'p': s = ( V_p[pos] == K_p[pos] ); if (!s) printf("'p':%d: %lld != %lld ; ", pos, (long long) V_p[pos], (long long) K_p[pos]); break; - case 'f': s = ( V_f[pos] == K_f[pos] ); if (!s) printf("'f':%d: %f != %f ; ", pos, V_f[pos], K_f[pos]); break; - case 'd': s = ( V_d[pos] == K_d[pos] ); if (!s) printf("'d':%d: %f != %f ; ", pos, V_d[pos], K_d[pos]); break; + case 'p': s = ( V_p[pos] == K_p[pos] ); if (!s) printf("'p':%d: %p != %p ; ", pos, V_p[pos], K_p[pos]); break; + case 'f': s = ( V_f[pos] == K_f[pos] ); if (!s) printf("'f':%d: %f != %f ; ", pos, V_f[pos], K_f[pos]); break; + case 'd': s = ( V_d[pos] == K_d[pos] ); if (!s) printf("'d':%d: %f != %f ; ", pos, V_d[pos], K_d[pos]); break; default: printf("unknown atype '%c' ; ", atype); return 0; } if (!s) { @@ -130,10 +130,13 @@ dcTest_initPlatform(); - init_K(G_maxargs); + init_test_data(G_maxargs); G_callvm = (DCCallVM*) dcNewCallVM(4096); dcReset(G_callvm); total = run_all(); + dcFree(G_callvm); + deinit_test_data(G_maxargs); + printf("result: call_suite: %d\n", total); dcTest_deInitPlatform();