diff options
Diffstat (limited to 'src/junit/com/jogamp/gluegen/test/junit/generation/test2.c')
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/test2.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c index 75eafcf..e5c1fe2 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test2.c @@ -1,9 +1,14 @@ -#include "test2.h" - +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +typedef struct { + int value; +} T2_UndefStruct; + +#include "test2.h" + static int32_t CustomFuncA1(void* aptr) { (void)aptr; return 0xa001; @@ -33,6 +38,8 @@ int Initialize(T2_InitializeOptions* Options) { *( (T2_CustomFuncA*) &Options->CustomFuncA2 ) = CustomFuncA2; // yuck: real yuck Options->CustomFuncB1 = CustomFuncB1; Options->CustomFuncB2 = CustomFuncB2; + Options->customFuncBVariants[0] = CustomFuncB1; + Options->customFuncBVariants[1] = CustomFuncB2; Options->OverrideThreadAffinity = NULL; } @@ -52,4 +59,31 @@ int Release(T2_InitializeOptions* Options) { Options->CustomFuncB2 = NULL; } +static int32_t StaticInt32Array[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; +static T2_UndefStruct StaticUndefStructArray[] = { { 0 }, { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }, { 9 } }; + +T2_PointerStorage * createT2PointerStorage() { + T2_PointerStorage * s = calloc(1, sizeof(T2_PointerStorage)); + for(int i=0; i<10; ++i) { + s->int32PtrArray[i] = &StaticInt32Array[i]; + } + s->undefStructPtr = &StaticUndefStructArray[0]; + for(int i=0; i<10; ++i) { + s->undefStructPtrArray[i] = &StaticUndefStructArray[i]; + } + + for(int i=0; i<10; ++i) { + s->customFuncAVariantsArray[i] = ( i %2 == 0 ) ? CustomFuncA1 : CustomFuncA2; + } + for(int i=0; i<10; ++i) { + s->customFuncBVariantsArray[i] = ( i %2 == 0 ) ? CustomFuncB1 : CustomFuncB2; + } + return s; +} + +void destroyT2PointerStorage(T2_PointerStorage * s) { + assert(NULL!=s); + memset(s, 0, sizeof(T2_PointerStorage)); + free(s); +} |