Merged revision(s) 2898 from branches/releases/bacnet-stack-0-8-0:

Cleanup of unit test exports.
........
This commit is contained in:
skarg
2015-10-18 00:27:09 +00:00
parent 3b28372e8b
commit 5a0ed5a9e0
6 changed files with 99 additions and 39 deletions
+6
View File
@@ -78,6 +78,12 @@ extern "C" {
uint8_t * apdu,
int32_t * value);
#ifdef TEST
#include "ctest.h"
void testBACnetIntegers(
Test * pTest);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
+6
View File
@@ -185,6 +185,12 @@ extern "C" {
uint8_t tag_number,
BACNET_DATE_TIME * value);
#ifdef TEST
#include "ctest.h"
void testDateTime(
Test * pTest);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
+11
View File
@@ -84,6 +84,11 @@ extern "C" {
OS_Keylist list,
KEY key);
/* returns the index from the node specified by key */
int Keylist_Index(
OS_Keylist list,
KEY key);
/* returns the data specified by key */
void *Keylist_Data_Index(
OS_Keylist list,
@@ -103,6 +108,12 @@ extern "C" {
int Keylist_Count(
OS_Keylist list);
#ifdef TEST
#include "ctest.h"
void testKeyList(
Test * pTest);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
+20 -12
View File
@@ -228,7 +228,7 @@ int decode_signed32(
#include <ctype.h>
#include "ctest.h"
void testBACnetUnsigned16(
static void testBACnetUnsigned16(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -245,7 +245,7 @@ void testBACnetUnsigned16(
}
}
void testBACnetUnsigned24(
static void testBACnetUnsigned24(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -262,7 +262,7 @@ void testBACnetUnsigned24(
}
}
void testBACnetUnsigned32(
static void testBACnetUnsigned32(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -279,7 +279,7 @@ void testBACnetUnsigned32(
}
}
void testBACnetSigned8(
static void testBACnetSigned8(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -296,7 +296,7 @@ void testBACnetSigned8(
}
}
void testBACnetSigned16(
static void testBACnetSigned16(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -313,7 +313,7 @@ void testBACnetSigned16(
}
}
void testBACnetSigned24(
static void testBACnetSigned24(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -328,7 +328,7 @@ void testBACnetSigned24(
}
}
void testBACnetSigned32(
static void testBACnetSigned32(
Test * pTest)
{
uint8_t apdu[32] = { 0 };
@@ -349,14 +349,12 @@ void testBACnetSigned32(
}
}
#ifdef TEST_BACINT
int main(
void)
void testBACnetIntegers(
Test * pTest)
{
Test *pTest;
bool rc;
pTest = ct_create("BACint", NULL);
assert(pTest);
/* individual tests */
rc = ct_addTestFunction(pTest, testBACnetUnsigned16);
assert(rc);
@@ -372,6 +370,16 @@ int main(
assert(rc);
rc = ct_addTestFunction(pTest, testBACnetSigned32);
assert(rc);
}
#ifdef TEST_BACINT
int main(
void)
{
Test *pTest;
pTest = ct_create("BACint", NULL);
testBACnetIntegers(pTest);
/* configure output */
ct_setStream(pTest, stdout);
ct_run(pTest);
+21 -16
View File
@@ -762,7 +762,7 @@ int bacapp_decode_context_datetime(
#include <string.h>
#include "ctest.h"
void testBACnetDateTimeWildcard(
static void testBACnetDateTimeWildcard(
Test * pTest)
{
BACNET_DATE_TIME bdatetime;
@@ -777,7 +777,7 @@ void testBACnetDateTimeWildcard(
ct_test(pTest, status == true);
}
void testBACnetDateTimeAdd(
static void testBACnetDateTimeAdd(
Test * pTest)
{
BACNET_DATE_TIME bdatetime, test_bdatetime;
@@ -821,7 +821,7 @@ void testBACnetDateTimeAdd(
ct_test(pTest, diff == 0);
}
void testBACnetDateTimeSeconds(
static void testBACnetDateTimeSeconds(
Test * pTest)
{
uint8_t hour = 0, minute = 0, second = 0;
@@ -843,7 +843,7 @@ void testBACnetDateTimeSeconds(
}
}
void testBACnetDate(
static void testBACnetDate(
Test * pTest)
{
BACNET_DATE bdate1, bdate2;
@@ -905,7 +905,7 @@ void testBACnetDate(
return;
}
void testBACnetTime(
static void testBACnetTime(
Test * pTest)
{
BACNET_TIME btime1, btime2;
@@ -955,7 +955,7 @@ void testBACnetTime(
return;
}
void testBACnetDateTime(
static void testBACnetDateTime(
Test * pTest)
{
BACNET_DATE_TIME bdatetime1, bdatetime2;
@@ -1023,7 +1023,7 @@ void testBACnetDateTime(
return;
}
void testDayOfYear(
static void testDayOfYear(
Test * pTest)
{
uint32_t days = 0;
@@ -1061,7 +1061,7 @@ void testDayOfYear(
}
}
void testDateEpoch(
static void testDateEpoch(
Test * pTest)
{
uint32_t days = 0;
@@ -1091,7 +1091,7 @@ void testDateEpoch(
}
}
void testBACnetDayOfWeek(
static void testBACnetDayOfWeek(
Test * pTest)
{
uint8_t dow = 0;
@@ -1120,7 +1120,7 @@ void testBACnetDayOfWeek(
ct_test(pTest, dow == 3);
}
void testDatetimeCodec(
static void testDatetimeCodec(
Test * pTest)
{
uint8_t apdu[MAX_APDU];
@@ -1156,15 +1156,11 @@ void testDatetimeCodec(
}
#ifdef TEST_DATE_TIME
int main(
void)
void testDateTime(
Test * pTest)
{
Test *pTest;
bool rc;
pTest = ct_create("BACnet Date Time", NULL);
/* individual tests */
rc = ct_addTestFunction(pTest, testBACnetDate);
assert(rc);
@@ -1186,7 +1182,16 @@ int main(
assert(rc);
rc = ct_addTestFunction(pTest, testDayOfYear);
assert(rc);
}
#ifdef TEST_DATE_TIME
int main(
void)
{
Test *pTest;
pTest = ct_create("BACnet Date Time", NULL);
testDateTime(pTest);
ct_setStream(pTest, stdout);
ct_run(pTest);
(void) ct_report(pTest);
+35 -11
View File
@@ -308,6 +308,23 @@ void *Keylist_Data(
return node ? node->data : NULL;
}
/* returns the index from the node specified by key */
int Keylist_Index(
OS_Keylist list,
KEY key)
{
int index = -1; /* used to look up the index of node */
if (list && list->array && list->count) {
if (!FindIndex(list, key, &index)) {
index = -1;
}
}
return index;
}
/* returns the data specified by key */
void *Keylist_Data_Index(
OS_Keylist list,
@@ -406,7 +423,7 @@ void Keylist_Delete(
#include "ctest.h"
/* test the FIFO */
void testKeyListFIFO(
static void testKeyListFIFO(
Test * pTest)
{
OS_Keylist list;
@@ -450,7 +467,7 @@ void testKeyListFIFO(
}
/* test the FILO */
void testKeyListFILO(
static void testKeyListFILO(
Test * pTest)
{
OS_Keylist list;
@@ -497,7 +514,7 @@ void testKeyListFILO(
return;
}
void testKeyListDataKey(
static void testKeyListDataKey(
Test * pTest)
{
OS_Keylist list;
@@ -578,7 +595,7 @@ void testKeyListDataKey(
return;
}
void testKeyListDataIndex(
static void testKeyListDataIndex(
Test * pTest)
{
OS_Keylist list;
@@ -650,7 +667,7 @@ void testKeyListDataIndex(
}
/* test access of a lot of entries */
void testKeyListLarge(
static void testKeyListLarge(
Test * pTest)
{
int data1 = 42;
@@ -681,15 +698,12 @@ void testKeyListLarge(
return;
}
#ifdef TEST_KEYLIST
int main(
void)
/* test access of a lot of entries */
void testKeyList(
Test * pTest)
{
Test *pTest;
bool rc;
pTest = ct_create("keylist", NULL);
/* individual tests */
rc = ct_addTestFunction(pTest, testKeyListFIFO);
assert(rc);
@@ -701,7 +715,17 @@ int main(
assert(rc);
rc = ct_addTestFunction(pTest, testKeyListLarge);
assert(rc);
}
#ifdef TEST_KEYLIST
int main(
void)
{
Test *pTest;
bool rc;
pTest = ct_create("keylist", NULL);
testKeyList(pTest);
ct_setStream(pTest, stdout);
ct_run(pTest);
(void) ct_report(pTest);