From 6230600eebb662a35ccb4b822f14423cf70fbe76 Mon Sep 17 00:00:00 2001 From: skarg Date: Thu, 10 Aug 2006 20:14:32 +0000 Subject: [PATCH] Moved apdu decode into unit test where it was being used since it is being decoded in apdu.c in normal usage. --- bacnet-stack/bacerror.c | 10 +++++----- bacnet-stack/bacerror.h | 12 ++++++------ bacnet-stack/dcc.c | 10 +++++----- bacnet-stack/dcc.h | 4 ++-- bacnet-stack/rd.c | 10 +++++----- bacnet-stack/rd.h | 4 ++-- bacnet-stack/reject.c | 10 +++++----- bacnet-stack/reject.h | 2 +- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bacnet-stack/bacerror.c b/bacnet-stack/bacerror.c index fc38be4a..2e8110d6 100644 --- a/bacnet-stack/bacerror.c +++ b/bacnet-stack/bacerror.c @@ -113,6 +113,11 @@ int bacerror_decode_service_request(uint8_t * apdu, return len; } +#ifdef TEST +#include +#include +#include "ctest.h" + /* decode the whole APDU - mainly used for unit testing */ int bacerror_decode_apdu(uint8_t * apdu, unsigned apdu_len, @@ -137,11 +142,6 @@ int bacerror_decode_apdu(uint8_t * apdu, return len; } -#ifdef TEST -#include -#include -#include "ctest.h" - void testBACError(Test * pTest) { uint8_t apdu[480] = { 0 }; diff --git a/bacnet-stack/bacerror.h b/bacnet-stack/bacerror.h index 06920f4e..60b3c883 100644 --- a/bacnet-stack/bacerror.h +++ b/bacnet-stack/bacerror.h @@ -53,18 +53,18 @@ extern "C" { BACNET_CONFIRMED_SERVICE * service, BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code); - int bacerror_decode_apdu(uint8_t * apdu, - unsigned apdu_len, - uint8_t * invoke_id, - BACNET_CONFIRMED_SERVICE * service, - BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code); - int bacerror_decode_error_class_and_code(uint8_t * apdu, unsigned apdu_len, BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code); #ifdef TEST #include "ctest.h" + int bacerror_decode_apdu(uint8_t * apdu, + unsigned apdu_len, + uint8_t * invoke_id, + BACNET_CONFIRMED_SERVICE * service, + BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code); + void testBACError(Test * pTest); #endif diff --git a/bacnet-stack/dcc.c b/bacnet-stack/dcc.c index afea71bb..10d6a883 100644 --- a/bacnet-stack/dcc.c +++ b/bacnet-stack/dcc.c @@ -201,6 +201,11 @@ int dcc_decode_service_request(uint8_t * apdu, return (int) len; } +#ifdef TEST +#include +#include +#include "ctest.h" + int dcc_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, @@ -230,11 +235,6 @@ int dcc_decode_apdu(uint8_t * apdu, return len; } -#ifdef TEST -#include -#include -#include "ctest.h" - void test_DeviceCommunicationControlData(Test * pTest, uint8_t invoke_id, uint16_t timeDuration, diff --git a/bacnet-stack/dcc.h b/bacnet-stack/dcc.h index b248ead5..c4557120 100644 --- a/bacnet-stack/dcc.h +++ b/bacnet-stack/dcc.h @@ -68,6 +68,8 @@ extern "C" { BACNET_COMMUNICATION_ENABLE_DISABLE * enable_disable, BACNET_CHARACTER_STRING * password); +#ifdef TEST +#include "ctest.h" int dcc_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, @@ -75,8 +77,6 @@ extern "C" { BACNET_COMMUNICATION_ENABLE_DISABLE * enable_disable, BACNET_CHARACTER_STRING * password); -#ifdef TEST -#include "ctest.h" void test_DeviceCommunicationControl(Test * pTest); #endif diff --git a/bacnet-stack/rd.c b/bacnet-stack/rd.c index 6b1784a9..f814471d 100644 --- a/bacnet-stack/rd.c +++ b/bacnet-stack/rd.c @@ -100,6 +100,11 @@ int rd_decode_service_request(uint8_t * apdu, return (int) len; } +#ifdef TEST +#include +#include +#include "ctest.h" + int rd_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, @@ -127,11 +132,6 @@ int rd_decode_apdu(uint8_t * apdu, return len; } -#ifdef TEST -#include -#include -#include "ctest.h" - void test_ReinitializeDevice(Test * pTest) { uint8_t apdu[480] = { 0 }; diff --git a/bacnet-stack/rd.h b/bacnet-stack/rd.h index 415e65f4..ad16a64c 100644 --- a/bacnet-stack/rd.h +++ b/bacnet-stack/rd.h @@ -53,14 +53,14 @@ extern "C" { BACNET_REINITIALIZED_STATE * state, BACNET_CHARACTER_STRING * password); +#ifdef TEST +#include "ctest.h" int rd_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, BACNET_REINITIALIZED_STATE * state, BACNET_CHARACTER_STRING * password); -#ifdef TEST -#include "ctest.h" void test_ReinitializeDevice(Test * pTest); #endif diff --git a/bacnet-stack/reject.c b/bacnet-stack/reject.c index 91fd716c..8edc441d 100644 --- a/bacnet-stack/reject.c +++ b/bacnet-stack/reject.c @@ -68,6 +68,11 @@ int reject_decode_service_request(uint8_t * apdu, return len; } +#ifdef TEST +#include +#include +#include "ctest.h" + /* decode the whole APDU - mainly used for unit testing */ int reject_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, uint8_t * reject_reason) @@ -89,11 +94,6 @@ int reject_decode_apdu(uint8_t * apdu, return len; } -#ifdef TEST -#include -#include -#include "ctest.h" - void testReject(Test * pTest) { uint8_t apdu[480] = { 0 }; diff --git a/bacnet-stack/reject.h b/bacnet-stack/reject.h index 14a73977..83d11d1d 100644 --- a/bacnet-stack/reject.h +++ b/bacnet-stack/reject.h @@ -47,10 +47,10 @@ extern "C" { int reject_decode_service_request(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, uint8_t * reject_reason); +#ifdef TEST int reject_decode_apdu(uint8_t * apdu, unsigned apdu_len, uint8_t * invoke_id, uint8_t * reject_reason); -#ifdef TEST void testReject(Test * pTest); #endif