testsuite/src/c/TestQueue.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <util/queue/QueueInterface.h>
#include "test.h"

Include dependency graph for TestQueue.c:

Go to the source code of this file.

Defines

#define ERRORSTR_LEN   EXCEPTIONSTRUCT_ERRORCODE_LEN + EXCEPTIONSTRUCT_MESSAGE_LEN + 64
#define mu_assert_checkException(message, exception)
#define mu_assert_checkWantException(message, exception)

Functions

static int destroy (char *dbName)
 Kill complete DB on HD.
static char * test_illegal ()
 Test illegal function call parameters.
static char * test_overflow ()
 Test overflow of maxNumOfBytes and maxNumOfEntries.
static char * test_queue ()
 Test invocation of all queue methods.
static char * all_tests ()
int main (int argc_, char **argv_)

Variables

static int argc = 0
static char ** argv = 0
static char errorString [56+1024+64]
static char int64Str_ [32]
static char * int64Str = int64Str_
static char int64StrX_ [32]
static char * int64StrX = int64StrX_
static XmlBlasterLogging loggingFp = xmlBlasterDefaultLogging


Define Documentation

#define ERRORSTR_LEN   EXCEPTIONSTRUCT_ERRORCODE_LEN + EXCEPTIONSTRUCT_MESSAGE_LEN + 64

Definition at line 20 of file TestQueue.c.

Referenced by destroy().

#define mu_assert_checkException ( message,
exception   ) 

Value:

do {\
         if (*exception.errorCode != 0) {\
            sprintf(MU_ASSERT_TEXT, "[TEST FAIL]%s:%d %s: Caught exception: '%s'", __FILE__, __LINE__, message, getExceptionStr(errorString, ERRORSTR_LEN, &exception));\
            return MU_ASSERT_TEXT;\
         }\
      } while (0)

Definition at line 29 of file TestQueue.c.

Referenced by test_illegal(), test_overflow(), and test_queue().

#define mu_assert_checkWantException ( message,
exception   ) 

Value:

do {\
         if (*exception.errorCode == 0) {\
            sprintf(MU_ASSERT_TEXT, "[TEST FAIL]%s:%d %s: Missing exception", __FILE__, __LINE__, message);\
            return MU_ASSERT_TEXT;\
         }\
         else {\
            char out[1024];\
            printf("OK, expected exception: %s\n", getExceptionStr(out, 1024, &exception));\
         }\
      } while (0)

Definition at line 37 of file TestQueue.c.

Referenced by test_illegal(), and test_overflow().


Function Documentation

static char* all_tests (  )  [static]

Definition at line 619 of file TestQueue.c.

References test_illegal(), test_overflow(), and test_queue().

Referenced by main().

Here is the call graph for this function:

static int destroy ( char *  dbName  )  [static]

Kill complete DB on HD.

Definition at line 54 of file TestQueue.c.

References createQueue(), QueueProperties::dbName, I_QueueStruct::destroy, ERRORSTR_LEN, errorString, getExceptionStr(), QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, QUEUE_DBNAME_MAX, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueProperties::queueName, strncpy0(), and QueueProperties::tablePrefix.

Referenced by test_illegal(), test_overflow(), and test_queue().

Here is the call graph for this function:

int main ( int  argc_,
char **  argv_ 
)

Definition at line 627 of file TestQueue.c.

References all_tests(), argc, and argv.

Here is the call graph for this function:

static char* test_illegal (  )  [static]

Test illegal function call parameters.

Definition at line 80 of file TestQueue.c.

References I_QueueStruct::clear, createQueue(), QueueProperties::dbName, destroy(), I_QueueStruct::empty, freeQueueEntryArr(), I_QueueStruct::getNumOfBytes, I_QueueStruct::getNumOfEntries, QueueEntryStructArr::len, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, mu_assert_checkException, mu_assert_checkWantException, I_QueueStruct::peekWithSamePriority, I_QueueStruct::put, QUEUE_DBNAME_MAX, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueEntryStructArr::queueEntryArr, QueueProperties::queueName, I_QueueStruct::randomRemove, strncpy0(), and QueueProperties::tablePrefix.

Referenced by all_tests().

Here is the call graph for this function:

static char* test_overflow (  )  [static]

Test overflow of maxNumOfBytes and maxNumOfEntries.

Definition at line 181 of file TestQueue.c.

References createQueue(), QueueProperties::dbName, destroy(), I_QueueStruct::getMaxNumOfEntries, int64Str, int64StrX, int64ToStr(), QueueProperties::logFp, loggingFp, QueueProperties::logLevel, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, mu_assert_checkException, mu_assert_checkWantException, QUEUE_DBNAME_MAX, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueProperties::queueName, strncpy0(), QueueProperties::tablePrefix, QueueProperties::userObject, and XMLBLASTER_LOG_TRACE.

Referenced by all_tests().

Here is the call graph for this function:

static char* test_queue (  )  [static]

Test invocation of all queue methods.

Definition at line 314 of file TestQueue.c.

References createQueue(), BlobHolder::data, BlobHolder::dataLen, QueueProperties::dbName, destroy(), QueueEntry::embeddedBlob, freeEntryDump(), freeQueueEntryArr(), I_QueueStruct::getMaxNumOfEntries, I_QueueStruct::getProperties, int64Str, int64StrX, int64ToStr(), I_QueueStruct::isInitialized, QueueEntry::isPersistent, QueueEntryStructArr::len, QueueProperties::logFp, loggingFp, QueueProperties::logLevel, QueueProperties::maxNumOfBytes, QueueProperties::maxNumOfEntries, mu_assert_checkException, QueueEntry::priority, QUEUE_DBNAME_MAX, QUEUE_ENTRY_EMBEDDEDTYPE_LEN, QUEUE_ID_MAX, QUEUE_PREFIX_MAX, QueueEntryStructArr::queueEntryArr, queueEntryToXml(), QueueProperties::queueName, strFromBlobAlloc(), strncpy0(), QueueProperties::tablePrefix, QueueEntry::uniqueId, I_QueueStruct::userObject, QueueProperties::userObject, and XMLBLASTER_LOG_TRACE.

Referenced by all_tests().

Here is the call graph for this function:


Variable Documentation

int argc = 0 [static]

Definition at line 18 of file TestQueue.c.

Referenced by main().

char** argv = 0 [static]

Definition at line 19 of file TestQueue.c.

Referenced by convertWcsArgv(), and main().

char errorString[56+1024+64] [static]

Definition at line 21 of file TestQueue.c.

Referenced by destroy().

char* int64Str = int64Str_ [static]

Definition at line 23 of file TestQueue.c.

char int64Str_[32] [static]

Definition at line 22 of file TestQueue.c.

char* int64StrX = int64StrX_ [static]

Definition at line 25 of file TestQueue.c.

Referenced by test_overflow(), and test_queue().

char int64StrX_[32] [static]

Definition at line 24 of file TestQueue.c.

XmlBlasterLogging loggingFp = xmlBlasterDefaultLogging [static]

Definition at line 27 of file TestQueue.c.

Referenced by test_overflow(), and test_queue().