Moved apdu decode into unit test where it was being used since it is being decoded in apdu.c in normal usage.
This commit is contained in:
@@ -113,6 +113,11 @@ int bacerror_decode_service_request(uint8_t * apdu,
|
||||
return len;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#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 <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testBACError(Test * pTest)
|
||||
{
|
||||
uint8_t apdu[480] = { 0 };
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+5
-5
@@ -201,6 +201,11 @@ int dcc_decode_service_request(uint8_t * apdu,
|
||||
return (int) len;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#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 <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void test_DeviceCommunicationControlData(Test * pTest,
|
||||
uint8_t invoke_id,
|
||||
uint16_t timeDuration,
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
+5
-5
@@ -100,6 +100,11 @@ int rd_decode_service_request(uint8_t * apdu,
|
||||
return (int) len;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#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 <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void test_ReinitializeDevice(Test * pTest)
|
||||
{
|
||||
uint8_t apdu[480] = { 0 };
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
@@ -68,6 +68,11 @@ int reject_decode_service_request(uint8_t * apdu,
|
||||
return len;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#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 <assert.h>
|
||||
#include <string.h>
|
||||
#include "ctest.h"
|
||||
|
||||
void testReject(Test * pTest)
|
||||
{
|
||||
uint8_t apdu[480] = { 0 };
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user