Don't use contexts if they do not exist
diff --git a/test/context.c b/test/context.c
index 75596c4..bc10621 100644
--- a/test/context.c
+++ b/test/context.c
@@ -15,8 +15,8 @@
typedef struct {
cn_cbor_context context;
byte *pFirst;
- unsigned int iFailLeft;
- int allocCount;
+ ssize_t iFailLeft;
+ ssize_t allocCount;
} MyContext;
typedef struct _MyItem {
diff --git a/test/memory_test.c b/test/memory_test.c
index d17b9c9..19014d9 100644
--- a/test/memory_test.c
+++ b/test/memory_test.c
@@ -5,9 +5,9 @@
#include <string.h>
#include "cn-cbor/cn-cbor.h"
-#include "context.h"
#ifdef USE_CBOR_CONTEXT
+#include "context.h"
#define CBOR_CONTEXT_PARAM , NULL
#else
#define CBOR_CONTEXT_PARAM
@@ -15,6 +15,7 @@
int CFails;
+#ifdef USE_CBOR_CONTEXT
void CreateTests()
{
cn_cbor_context* context = CreateContext(-1);
@@ -198,12 +199,14 @@
CFails += 1;
}
}
+#endif
int main(void)
{
+#ifdef USE_CBOR_CONTEXT
CreateTests();
EncoderTests();
DecoderTests();
-
+#endif
return CFails;
}