Implement missing data types for calendar and schedule (#474)
* Added the SpecialEvent struct for the Exception_Schedule property of Schedule, encode/decode/same functions, unit tests, and integrated into bacapp functions. * Added the CalendarEntry struct for the Date_List property of Calendar and the SpecialEvent struct, encode/decode functions, unit tests, and integrated into bacapp functions. * Added the DateRange struct for the Effective_Period property of Schedule, encode/decode functions, unit tests, and integrated into bacapp functions. --------- Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -38,6 +38,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/bacint.c
|
||||
${SRC_DIR}/bacnet/bacreal.c
|
||||
${SRC_DIR}/bacnet/bacstr.c
|
||||
${SRC_DIR}/bacnet/datetime.c
|
||||
${SRC_DIR}/bacnet/basic/sys/days.c
|
||||
${SRC_DIR}/bacnet/basic/sys/bigend.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
|
||||
+169
-19
@@ -7,10 +7,11 @@
|
||||
/* @file
|
||||
* @brief test BACnet integer encode/decode APIs
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <ctype.h> /* For isprint */
|
||||
#include <zephyr/ztest.h>
|
||||
#include <bacnet/bacdcode.h>
|
||||
#include <memory.h>
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
@@ -301,7 +302,7 @@ static void testBACDCodeReal(void)
|
||||
#if defined(BACNET_STACK_DEPRECATED_DISABLE)
|
||||
encode_bacnet_real(value, &real_apdu[0]);
|
||||
decode_real(&real_apdu[0], &decoded_value);
|
||||
zassert_equal(decoded_value, value, NULL);
|
||||
zassert_false(islessgreater(decoded_value, value), NULL);
|
||||
encode_bacnet_real(value, &encoded_apdu[0]);
|
||||
zassert_equal(
|
||||
memcmp(&real_apdu, &encoded_apdu, sizeof(real_apdu)), 0, NULL);
|
||||
@@ -320,7 +321,7 @@ static void testBACDCodeReal(void)
|
||||
zassert_equal(len, 1, NULL);
|
||||
zassert_equal(long_value, 4, NULL);
|
||||
decode_real(&apdu[len], &decoded_value);
|
||||
zassert_equal(decoded_value, value, NULL);
|
||||
zassert_false(islessgreater(decoded_value, value), NULL);
|
||||
#endif
|
||||
null_len = bacnet_real_application_decode(apdu, apdu_len, NULL);
|
||||
zassert_equal(apdu_len, null_len, NULL);
|
||||
@@ -331,7 +332,7 @@ static void testBACDCodeReal(void)
|
||||
zassert_equal(tag.number, BACNET_APPLICATION_TAG_REAL, NULL);
|
||||
zassert_true(tag.application, NULL);
|
||||
zassert_false(tag.context, NULL);
|
||||
zassert_equal(decoded_value, value, NULL);
|
||||
zassert_false(islessgreater(decoded_value, value), NULL);
|
||||
while (apdu_len) {
|
||||
apdu_len--;
|
||||
len = bacnet_real_application_decode(apdu, apdu_len, NULL);
|
||||
@@ -358,7 +359,7 @@ static void testBACDCodeDouble(void)
|
||||
#if defined(BACNET_STACK_DEPRECATED_DISABLE)
|
||||
encode_bacnet_double(value, &double_apdu[0]);
|
||||
decode_double(&double_apdu[0], &decoded_value);
|
||||
zassert_equal(decoded_value, value, NULL);
|
||||
zassert_false(islessgreater(decoded_value, value), NULL);
|
||||
encode_bacnet_double(value, &encoded_apdu[0]);
|
||||
zassert_equal(
|
||||
memcmp(&double_apdu, &encoded_apdu, sizeof(double_apdu)), 0, NULL);
|
||||
@@ -390,7 +391,7 @@ static void testBACDCodeDouble(void)
|
||||
zassert_false(tag.context, NULL);
|
||||
zassert_false(tag.closing, NULL);
|
||||
zassert_false(tag.opening, NULL);
|
||||
zassert_equal(decoded_value, value, NULL);
|
||||
zassert_false(islessgreater(decoded_value, value), NULL);
|
||||
while (apdu_len) {
|
||||
apdu_len--;
|
||||
len = bacnet_double_application_decode(apdu, apdu_len, NULL);
|
||||
@@ -400,6 +401,107 @@ static void testBACDCodeDouble(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(bacdcode_tests, testBACnetDateDecodes)
|
||||
#else
|
||||
static void testBACnetDateDecodes(void)
|
||||
#endif
|
||||
{
|
||||
uint8_t apdu[MAX_APDU];
|
||||
uint8_t sample[10] = { 0xa4, 0xff, 0xff, 0xff, 0xff };
|
||||
int inLen;
|
||||
int outLen;
|
||||
int outLen2;
|
||||
|
||||
BACNET_DATE in;
|
||||
BACNET_DATE out;
|
||||
|
||||
in.day = 3;
|
||||
in.month = 10;
|
||||
in.wday = 5;
|
||||
in.year = 1945;
|
||||
|
||||
inLen = encode_application_date(apdu, &in);
|
||||
outLen = decode_application_date(apdu, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in.day, out.day, NULL);
|
||||
zassert_equal(in.month, out.month, NULL);
|
||||
zassert_equal(in.wday, out.wday, NULL);
|
||||
zassert_equal(in.year, out.year, NULL);
|
||||
|
||||
memset(&out, 0, sizeof(out));
|
||||
outLen = decode_application_date(sample, &out);
|
||||
|
||||
/* try decoding sample data captured from a bacnet device - all wildcards */
|
||||
zassert_equal(5, outLen, NULL);
|
||||
zassert_equal(0xff, out.day, NULL);
|
||||
zassert_equal(0xff, out.month, NULL);
|
||||
zassert_equal(0xff, out.wday, NULL);
|
||||
zassert_equal(2155, out.year, NULL);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(bacdcode_tests, testBACnetDateRangeDecodes)
|
||||
#else
|
||||
static void testBACnetDateRangeDecodes(void)
|
||||
#endif
|
||||
{
|
||||
uint8_t apdu[MAX_APDU];
|
||||
uint8_t sample[10] = { 0xa4, 0xff, 0xff, 0xff, 0xff, 0xa4, 0xff, 0xff, 0xff,
|
||||
0xff };
|
||||
int len;
|
||||
int null_len;
|
||||
int test_len;
|
||||
int outLen2;
|
||||
|
||||
BACNET_DATE_RANGE data;
|
||||
BACNET_DATE_RANGE test_data;
|
||||
|
||||
memset(&test_data, 0, sizeof(test_data));
|
||||
|
||||
data.startdate.day = 3;
|
||||
data.startdate.month = 10;
|
||||
data.startdate.wday = 5;
|
||||
data.startdate.year = 1945;
|
||||
|
||||
data.enddate.day = 24;
|
||||
data.enddate.month = 8;
|
||||
data.enddate.wday = 4;
|
||||
data.enddate.year = 2023;
|
||||
|
||||
len = bacnet_daterange_encode(apdu, &data);
|
||||
null_len = bacnet_daterange_encode(NULL, &data);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
|
||||
test_len = bacnet_daterange_decode(apdu, len, &test_data);
|
||||
zassert_equal(len, test_len, NULL);
|
||||
zassert_equal(data.startdate.day, test_data.startdate.day, NULL);
|
||||
zassert_equal(data.startdate.month, test_data.startdate.month, NULL);
|
||||
zassert_equal(data.startdate.wday, test_data.startdate.wday, NULL);
|
||||
zassert_equal(data.startdate.year, test_data.startdate.year, NULL);
|
||||
|
||||
zassert_equal(data.enddate.day, test_data.enddate.day, NULL);
|
||||
zassert_equal(data.enddate.month, test_data.enddate.month, NULL);
|
||||
zassert_equal(data.enddate.wday, test_data.enddate.wday, NULL);
|
||||
zassert_equal(data.enddate.year, test_data.enddate.year, NULL);
|
||||
|
||||
memset(&test_data, 0, sizeof(test_data));
|
||||
test_len = bacnet_daterange_decode(sample, len, &test_data);
|
||||
|
||||
/* try decoding sample data captured from a bacnet device - all wildcards */
|
||||
zassert_equal(10, test_len, NULL);
|
||||
zassert_equal(0xff, test_data.startdate.day, NULL);
|
||||
zassert_equal(0xff, test_data.startdate.month, NULL);
|
||||
zassert_equal(0xff, test_data.startdate.wday, NULL);
|
||||
zassert_equal(2155, test_data.startdate.year, NULL);
|
||||
|
||||
zassert_equal(0xff, test_data.enddate.day, NULL);
|
||||
zassert_equal(0xff, test_data.enddate.month, NULL);
|
||||
zassert_equal(0xff, test_data.enddate.wday, NULL);
|
||||
zassert_equal(2155, test_data.enddate.year, NULL);
|
||||
}
|
||||
|
||||
static void verifyBACDCodeUnsignedValue(BACNET_UNSIGNED_INTEGER value)
|
||||
{
|
||||
uint8_t array[5] = { 0 };
|
||||
@@ -413,7 +515,7 @@ static void verifyBACDCodeUnsignedValue(BACNET_UNSIGNED_INTEGER value)
|
||||
len_value = encode_application_unsigned(&array[0], value);
|
||||
len = decode_tag_number_and_value(&array[0], &tag_number, &len_value);
|
||||
len = decode_unsigned(&array[len], len_value, &decoded_value);
|
||||
zassert_equal(decoded_value, value, "value=%lu decoded_value=%lu\n",
|
||||
zassert_equal(decoded_value, value, "value=%lu decoded_value=%lu\n",
|
||||
(unsigned long)value, (unsigned long)decoded_value);
|
||||
encode_application_unsigned(&encoded_array[0], decoded_value);
|
||||
zassert_equal(memcmp(&array[0], &encoded_array[0], sizeof(array)), 0, NULL);
|
||||
@@ -1155,7 +1257,7 @@ static void testFloatContextDecodes(void)
|
||||
outLen2 = bacnet_real_context_decode(apdu, inLen, 9, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
|
||||
inLen = encode_context_real(apdu, large_context_tag, in);
|
||||
@@ -1164,7 +1266,7 @@ static void testFloatContextDecodes(void)
|
||||
bacnet_real_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
|
||||
in = 0.0f;
|
||||
@@ -1173,7 +1275,7 @@ static void testFloatContextDecodes(void)
|
||||
outLen2 = bacnet_real_context_decode(apdu, inLen, 9, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
|
||||
inLen = encode_context_real(apdu, large_context_tag, in);
|
||||
outLen = bacnet_real_context_decode(apdu, inLen, large_context_tag, &out);
|
||||
@@ -1181,7 +1283,7 @@ static void testFloatContextDecodes(void)
|
||||
bacnet_real_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
while (inLen) {
|
||||
inLen--;
|
||||
@@ -1212,7 +1314,7 @@ static void testDoubleContextDecodes(void)
|
||||
outLen = bacnet_double_context_decode(apdu, inLen, 10, &out);
|
||||
outLen2 = bacnet_double_context_decode(apdu, inLen, 9, &out);
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
|
||||
inLen = encode_context_double(apdu, large_context_tag, in);
|
||||
@@ -1220,7 +1322,7 @@ static void testDoubleContextDecodes(void)
|
||||
outLen2 =
|
||||
bacnet_double_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
|
||||
in = 0.0;
|
||||
@@ -1228,7 +1330,7 @@ static void testDoubleContextDecodes(void)
|
||||
outLen = bacnet_double_context_decode(apdu, inLen, 10, &out);
|
||||
outLen2 = bacnet_double_context_decode(apdu, inLen, 9, &out);
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
|
||||
inLen = encode_context_double(apdu, large_context_tag, in);
|
||||
@@ -1236,7 +1338,7 @@ static void testDoubleContextDecodes(void)
|
||||
outLen2 =
|
||||
bacnet_double_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in, out, NULL);
|
||||
zassert_false(islessgreater(in, out), NULL);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
while (inLen) {
|
||||
inLen--;
|
||||
@@ -1517,15 +1619,16 @@ static void testDateContextDecodes(void)
|
||||
/* Test large tags */
|
||||
inLen = encode_context_date(apdu, large_context_tag, &in);
|
||||
outLen = bacnet_date_context_decode(apdu, inLen, large_context_tag, &out);
|
||||
outLen2 =
|
||||
bacnet_date_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
|
||||
zassert_equal(inLen, outLen, NULL);
|
||||
zassert_equal(in.day, out.day, NULL);
|
||||
zassert_equal(in.month, out.month, NULL);
|
||||
zassert_equal(in.wday, out.wday, NULL);
|
||||
zassert_equal(in.year, out.year, NULL);
|
||||
|
||||
/* incorrect tag */
|
||||
outLen2 =
|
||||
bacnet_date_context_decode(apdu, inLen, large_context_tag - 1, &out);
|
||||
zassert_equal(outLen2, 0, NULL);
|
||||
/* short APDU */
|
||||
while (inLen) {
|
||||
inLen--;
|
||||
outLen2 =
|
||||
@@ -1534,6 +1637,50 @@ static void testDateContextDecodes(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(bacdcode_tests, testDateRangeContextDecodes)
|
||||
#else
|
||||
static void testDateRangeContextDecodes(void)
|
||||
#endif
|
||||
{
|
||||
uint8_t apdu[MAX_APDU];
|
||||
int len;
|
||||
int null_len;
|
||||
int test_len;
|
||||
|
||||
BACNET_DATE_RANGE data;
|
||||
BACNET_DATE_RANGE test_data;
|
||||
memset(&data, 0, sizeof(data));
|
||||
memset(&test_data, 0, sizeof(test_data));
|
||||
|
||||
data.startdate.day = 3;
|
||||
data.startdate.month = 10;
|
||||
data.startdate.wday = 5;
|
||||
data.startdate.year = 1945;
|
||||
|
||||
data.enddate.day = 24;
|
||||
data.enddate.month = 8;
|
||||
data.enddate.wday = 4;
|
||||
data.enddate.year = 2023;
|
||||
|
||||
len = bacnet_daterange_context_encode(apdu, 10, &data);
|
||||
null_len = bacnet_daterange_context_encode(NULL, 10, &data);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
test_len = bacnet_daterange_context_decode(apdu, len, 10, &test_data);
|
||||
zassert_equal(len, test_len, NULL);
|
||||
zassert_equal(data.startdate.day, test_data.startdate.day, NULL);
|
||||
zassert_equal(data.startdate.month, test_data.startdate.month, NULL);
|
||||
zassert_equal(data.startdate.wday, test_data.startdate.wday, NULL);
|
||||
zassert_equal(data.startdate.year, test_data.startdate.year, NULL);
|
||||
zassert_equal(data.enddate.day, test_data.enddate.day, NULL);
|
||||
zassert_equal(data.enddate.month, test_data.enddate.month, NULL);
|
||||
zassert_equal(data.enddate.wday, test_data.enddate.wday, NULL);
|
||||
zassert_equal(data.enddate.year, test_data.enddate.year, NULL);
|
||||
/* incorrect tag number */
|
||||
test_len = bacnet_daterange_context_decode(apdu, len, 9, &test_data);
|
||||
zassert_equal(test_len, BACNET_STATUS_ERROR, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a BACnetARRAY property element; a function template
|
||||
* @param object_instance [in] BACnet network port object instance number
|
||||
@@ -1629,6 +1776,8 @@ void test_main(void)
|
||||
ztest_unit_test(testBACDCodeUnsigned),
|
||||
ztest_unit_test(testBACnetUnsigned),
|
||||
ztest_unit_test(testBACDCodeSigned), ztest_unit_test(testBACnetSigned),
|
||||
ztest_unit_test(testBACnetDateDecodes),
|
||||
ztest_unit_test(testBACnetDateRangeDecodes),
|
||||
ztest_unit_test(testBACDCodeEnumerated),
|
||||
ztest_unit_test(testBACDCodeOctetString),
|
||||
ztest_unit_test(testBACDCodeCharacterString),
|
||||
@@ -1645,6 +1794,7 @@ void test_main(void)
|
||||
ztest_unit_test(testBitStringContextDecodes),
|
||||
ztest_unit_test(testTimeContextDecodes),
|
||||
ztest_unit_test(testDateContextDecodes),
|
||||
ztest_unit_test(testDateRangeContextDecodes),
|
||||
ztest_unit_test(testOctetStringContextDecodes),
|
||||
ztest_unit_test(testBACDCodeDouble),
|
||||
ztest_unit_test(test_bacnet_array_encode));
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* @file
|
||||
* @brief test BACnet real value encode/decode APIs
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <zephyr/ztest.h>
|
||||
#include <bacnet/bacreal.h>
|
||||
#include <bacnet/bacdef.h>
|
||||
@@ -34,7 +34,7 @@ static void testBACreal(void)
|
||||
zassert_equal(len, 4, NULL);
|
||||
test_len = decode_real(&apdu[0], &test_real_value);
|
||||
zassert_equal(test_len, len, NULL);
|
||||
zassert_equal(test_real_value, real_value, NULL);
|
||||
zassert_false(islessgreater(test_real_value, real_value), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ static void testBACdouble(void)
|
||||
zassert_equal(len, 8, NULL);
|
||||
test_len = decode_double(&apdu[0], &test_double_value);
|
||||
zassert_equal(test_len, len, NULL);
|
||||
zassert_equal(test_double_value, double_value, NULL);
|
||||
zassert_false(islessgreater(test_double_value, double_value), NULL);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/timestamp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -60,6 +60,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/apdu_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
${SRC_DIR}/bacnet/memcopy.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
|
||||
@@ -96,6 +96,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
./stubs.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
./stubs.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
|
||||
@@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -59,6 +59,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./stubs.c
|
||||
./src/main.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/wp.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
../mock/device_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -270,7 +270,8 @@ static void testCOVSubscribePropertyData(
|
||||
zassert_equal(
|
||||
test_data->covIncrementPresent, data->covIncrementPresent, NULL);
|
||||
if (test_data->covIncrementPresent) {
|
||||
zassert_equal(test_data->covIncrement, data->covIncrement, NULL);
|
||||
zassert_false(islessgreater(test_data->covIncrement,
|
||||
data->covIncrement), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/bacstr.c
|
||||
${SRC_DIR}/bacnet/bactext.c
|
||||
${SRC_DIR}/bacnet/basic/sys/bigend.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/datetime.c
|
||||
${SRC_DIR}/bacnet/basic/sys/days.c
|
||||
${SRC_DIR}/bacnet/indtext.c
|
||||
@@ -55,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,7 +55,9 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
# Test and test library files
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
${ZTST_DIR}/ztest.c
|
||||
|
||||
@@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/lighting.c
|
||||
${SRC_DIR}/bacnet/timestamp.c
|
||||
${SRC_DIR}/bacnet/hostnport.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -291,8 +291,9 @@ static void testEventEventState(void)
|
||||
zassert_equal(data.notificationParams.changeOfValue.tag,
|
||||
data2.notificationParams.changeOfValue.tag, NULL);
|
||||
|
||||
zassert_equal(data.notificationParams.changeOfValue.newValue.changeValue,
|
||||
data2.notificationParams.changeOfValue.newValue.changeValue, NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.changeOfValue.newValue.changeValue,
|
||||
data2.notificationParams.changeOfValue.newValue.changeValue), NULL);
|
||||
|
||||
/*
|
||||
** Event Type = EVENT_CHANGE_OF_VALUE - bitstring value
|
||||
@@ -462,14 +463,15 @@ static void testEventEventState(void)
|
||||
apdu_len, test_len, "apdu_len=%d test_len=%d", apdu_len, test_len);
|
||||
verifyBaseEventState();
|
||||
|
||||
zassert_equal(data.notificationParams.floatingLimit.referenceValue,
|
||||
data2.notificationParams.floatingLimit.referenceValue, NULL);
|
||||
|
||||
zassert_equal(data.notificationParams.floatingLimit.setPointValue,
|
||||
data2.notificationParams.floatingLimit.setPointValue, NULL);
|
||||
|
||||
zassert_equal(data.notificationParams.floatingLimit.errorLimit,
|
||||
data2.notificationParams.floatingLimit.errorLimit, NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.floatingLimit.referenceValue,
|
||||
data2.notificationParams.floatingLimit.referenceValue), NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.floatingLimit.setPointValue,
|
||||
data2.notificationParams.floatingLimit.setPointValue), NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.floatingLimit.errorLimit,
|
||||
data2.notificationParams.floatingLimit.errorLimit), NULL);
|
||||
zassert_true(
|
||||
bitstring_same(&data.notificationParams.floatingLimit.statusFlags,
|
||||
&data2.notificationParams.floatingLimit.statusFlags),
|
||||
@@ -508,14 +510,16 @@ static void testEventEventState(void)
|
||||
zassert_equal(apdu_len, test_len, NULL);
|
||||
verifyBaseEventState();
|
||||
|
||||
zassert_equal(data.notificationParams.outOfRange.deadband,
|
||||
data2.notificationParams.outOfRange.deadband, NULL);
|
||||
zassert_false(islessgreater(data.notificationParams.outOfRange.deadband,
|
||||
data2.notificationParams.outOfRange.deadband), NULL);
|
||||
|
||||
zassert_equal(data.notificationParams.outOfRange.exceededLimit,
|
||||
data2.notificationParams.outOfRange.exceededLimit, NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.outOfRange.exceededLimit,
|
||||
data2.notificationParams.outOfRange.exceededLimit), NULL);
|
||||
|
||||
zassert_equal(data.notificationParams.outOfRange.exceedingValue,
|
||||
data2.notificationParams.outOfRange.exceedingValue, NULL);
|
||||
zassert_false(islessgreater(
|
||||
data.notificationParams.outOfRange.exceedingValue,
|
||||
data2.notificationParams.outOfRange.exceedingValue), NULL);
|
||||
zassert_true(bitstring_same(&data.notificationParams.outOfRange.statusFlags,
|
||||
&data2.notificationParams.outOfRange.statusFlags),
|
||||
NULL);
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||
|
||||
get_filename_component(basename ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(test_${basename}
|
||||
VERSION 1.0.0
|
||||
LANGUAGES C)
|
||||
|
||||
|
||||
string(REGEX REPLACE
|
||||
"/test/bacnet/[a-zA-Z_/-]*$"
|
||||
"/src"
|
||||
SRC_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
string(REGEX REPLACE
|
||||
"/test/bacnet/[a-zA-Z_/-]*$"
|
||||
"/test"
|
||||
TST_DIR
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(ZTST_DIR "${TST_DIR}/ztest/src")
|
||||
|
||||
add_compile_definitions(
|
||||
BIG_ENDIAN=0
|
||||
CONFIG_ZTEST=1
|
||||
BACAPP_ALL
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${SRC_DIR}
|
||||
${TST_DIR}/ztest/include
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
# File(s) under test
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Support files and stubs (pathname alphabetical)
|
||||
${SRC_DIR}/bacnet/bacaddr.c
|
||||
${SRC_DIR}/bacnet/bacapp.c
|
||||
${SRC_DIR}/bacnet/bacdcode.c
|
||||
${SRC_DIR}/bacnet/bacdest.c
|
||||
${SRC_DIR}/bacnet/bacdevobjpropref.c
|
||||
${SRC_DIR}/bacnet/bacint.c
|
||||
${SRC_DIR}/bacnet/bacreal.c
|
||||
${SRC_DIR}/bacnet/bacstr.c
|
||||
${SRC_DIR}/bacnet/bactext.c
|
||||
${SRC_DIR}/bacnet/basic/sys/bigend.c
|
||||
${SRC_DIR}/bacnet/datetime.c
|
||||
${SRC_DIR}/bacnet/basic/sys/days.c
|
||||
${SRC_DIR}/bacnet/indtext.c
|
||||
${SRC_DIR}/bacnet/hostnport.c
|
||||
${SRC_DIR}/bacnet/lighting.c
|
||||
${SRC_DIR}/bacnet/timestamp.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
${ZTST_DIR}/ztest.c
|
||||
)
|
||||
@@ -0,0 +1,377 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Unit test for BACnetSpecialEvent. This test also indirectly tests
|
||||
* BACnetCalendarEntry
|
||||
* @author Ondřej Hruška <ondra@ondrovo.com>
|
||||
* @date Aug 2023
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <zephyr/ztest.h>
|
||||
#include "bacnet/bactimevalue.h"
|
||||
#include "bacnet/special_event.h"
|
||||
#include "bacnet/calendar_entry.h"
|
||||
#include "bacnet/datetime.h"
|
||||
#include "bacnet/bacapp.h"
|
||||
|
||||
/**
|
||||
* @addtogroup bacnet_tests
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Test encode/decode API
|
||||
*/
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_CalendarRef)
|
||||
#else
|
||||
static void test_BACnetSpecialEvent_CalendarRef(void)
|
||||
#endif
|
||||
{
|
||||
int len, apdu_len, null_len;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
|
||||
BACNET_SPECIAL_EVENT in = {
|
||||
.periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE,
|
||||
.period = {
|
||||
.calendarReference = {
|
||||
.instance = 5,
|
||||
.type = OBJECT_CALENDAR,
|
||||
}
|
||||
},
|
||||
.timeValues = {
|
||||
.TV_Count = 2,
|
||||
.Time_Values = {
|
||||
{
|
||||
.Time = {
|
||||
.hour = 12,
|
||||
.min = 30,
|
||||
.sec = 15,
|
||||
.hundredths = 5
|
||||
},
|
||||
.Value = {
|
||||
.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT,
|
||||
.type = {
|
||||
.Unsigned_Int = 15,
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
.Time = {
|
||||
.hour = 16,
|
||||
.min = 1,
|
||||
.sec = 2,
|
||||
.hundredths = 3
|
||||
},
|
||||
.Value = {
|
||||
.tag = BACNET_APPLICATION_TAG_UNSIGNED_INT,
|
||||
.type = {
|
||||
.Unsigned_Int = 0,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
.priority = 5,
|
||||
};
|
||||
BACNET_SPECIAL_EVENT out = { 0 };
|
||||
|
||||
len = bacnet_special_event_encode(apdu, &in);
|
||||
null_len = bacnet_special_event_encode(NULL, &in);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
|
||||
apdu_len = bacnet_special_event_decode(apdu, len, &out);
|
||||
zassert_equal(len, apdu_len, NULL);
|
||||
|
||||
zassert_equal(in.periodTag, out.periodTag, NULL);
|
||||
zassert_equal(in.period.calendarReference.instance,
|
||||
out.period.calendarReference.instance, NULL);
|
||||
zassert_equal(in.period.calendarReference.type,
|
||||
out.period.calendarReference.type, NULL);
|
||||
zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.Time_Values[0].Time.hour,
|
||||
out.timeValues.Time_Values[0].Time.hour, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[0].Time.min,
|
||||
out.timeValues.Time_Values[0].Time.min, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[0].Time.sec,
|
||||
out.timeValues.Time_Values[0].Time.sec, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[0].Time.hundredths,
|
||||
out.timeValues.Time_Values[0].Time.hundredths, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.Time_Values[0].Value.tag,
|
||||
out.timeValues.Time_Values[0].Value.tag, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[0].Value.type.Unsigned_Int,
|
||||
out.timeValues.Time_Values[0].Value.type.Unsigned_Int, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.Time_Values[1].Time.hour,
|
||||
out.timeValues.Time_Values[1].Time.hour, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[1].Time.min,
|
||||
out.timeValues.Time_Values[1].Time.min, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[1].Time.sec,
|
||||
out.timeValues.Time_Values[1].Time.sec, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[1].Time.hundredths,
|
||||
out.timeValues.Time_Values[1].Time.hundredths, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.Time_Values[1].Value.tag,
|
||||
out.timeValues.Time_Values[1].Value.tag, NULL);
|
||||
zassert_equal(in.timeValues.Time_Values[1].Value.type.Unsigned_Int,
|
||||
out.timeValues.Time_Values[1].Value.type.Unsigned_Int, NULL);
|
||||
|
||||
zassert_equal(in.priority, out.priority, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test encode/decode API with Calendar Entry (Date variant)
|
||||
*/
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_Date)
|
||||
#else
|
||||
static void test_BACnetSpecialEvent_Date(void)
|
||||
#endif
|
||||
{
|
||||
int len, apdu_len, null_len;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
|
||||
BACNET_SPECIAL_EVENT in = {
|
||||
.periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY,
|
||||
.period = {
|
||||
.calendarEntry = {
|
||||
.tag = BACNET_CALENDAR_DATE,
|
||||
.type = {
|
||||
.Date = {
|
||||
.year = 2155,
|
||||
.month = 10,
|
||||
.day = 0xff,
|
||||
.wday = 0xff,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.timeValues = {
|
||||
.TV_Count = 0,
|
||||
.Time_Values = { 0 }
|
||||
},
|
||||
.priority = 16,
|
||||
};
|
||||
BACNET_SPECIAL_EVENT out = { 0 };
|
||||
|
||||
len = bacnet_special_event_encode(apdu, &in);
|
||||
null_len = bacnet_special_event_encode(NULL, &in);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
|
||||
apdu_len = bacnet_special_event_decode(apdu, len, &out);
|
||||
zassert_equal(len, apdu_len, NULL);
|
||||
zassert_equal(in.periodTag, out.periodTag, NULL);
|
||||
zassert_equal(
|
||||
in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.Date.wday,
|
||||
out.period.calendarEntry.type.Date.wday, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.Date.year,
|
||||
out.period.calendarEntry.type.Date.year, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.Date.month,
|
||||
out.period.calendarEntry.type.Date.month, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.Date.day,
|
||||
out.period.calendarEntry.type.Date.day, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL);
|
||||
zassert_equal(in.priority, out.priority, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test encode/decode API with Calendar Entry (DateRange variant)
|
||||
*/
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_DateRange)
|
||||
#else
|
||||
static void test_BACnetSpecialEvent_DateRange(void)
|
||||
#endif
|
||||
{
|
||||
int len, apdu_len, null_len;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
|
||||
BACNET_SPECIAL_EVENT in = {
|
||||
.periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY,
|
||||
.period = {
|
||||
.calendarEntry = {
|
||||
.tag = BACNET_CALENDAR_DATE_RANGE,
|
||||
.type = {
|
||||
.DateRange = {
|
||||
.startdate = {
|
||||
.day = 1,
|
||||
.month = 12,
|
||||
.year = 2155,
|
||||
.wday = 0xff,
|
||||
},
|
||||
.enddate = {
|
||||
.day = 31,
|
||||
.month = 12,
|
||||
.year = 2155,
|
||||
.wday = 0xff,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.timeValues = {
|
||||
.TV_Count = 0,
|
||||
.Time_Values = { 0 }
|
||||
},
|
||||
.priority = 0,
|
||||
};
|
||||
BACNET_SPECIAL_EVENT out = { 0 };
|
||||
|
||||
len = bacnet_special_event_encode(apdu, &in);
|
||||
null_len = bacnet_special_event_encode(NULL, &in);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
|
||||
apdu_len = bacnet_special_event_decode(apdu, len, &out);
|
||||
zassert_equal(len, apdu_len, "apdu_len %d != len %d", apdu_len, len);
|
||||
zassert_equal(in.periodTag, out.periodTag, NULL);
|
||||
|
||||
zassert_equal(
|
||||
in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL);
|
||||
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.startdate.wday,
|
||||
out.period.calendarEntry.type.DateRange.startdate.wday, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.startdate.year,
|
||||
out.period.calendarEntry.type.DateRange.startdate.year, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.startdate.month,
|
||||
out.period.calendarEntry.type.DateRange.startdate.month, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.startdate.day,
|
||||
out.period.calendarEntry.type.DateRange.startdate.day, NULL);
|
||||
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.enddate.wday,
|
||||
out.period.calendarEntry.type.DateRange.enddate.wday, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.enddate.year,
|
||||
out.period.calendarEntry.type.DateRange.enddate.year, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.enddate.month,
|
||||
out.period.calendarEntry.type.DateRange.enddate.month, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.DateRange.enddate.day,
|
||||
out.period.calendarEntry.type.DateRange.enddate.day, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL);
|
||||
zassert_equal(in.priority, out.priority, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test encode/decode API with Calendar Entry (Date variant)
|
||||
*/
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_WeekNDate)
|
||||
#else
|
||||
static void test_BACnetSpecialEvent_WeekNDate(void)
|
||||
#endif
|
||||
{
|
||||
int len, apdu_len, null_len;
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
|
||||
BACNET_SPECIAL_EVENT in = {
|
||||
.periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY,
|
||||
.period = {
|
||||
.calendarEntry = {
|
||||
.tag = BACNET_CALENDAR_WEEK_N_DAY,
|
||||
.type = {
|
||||
.WeekNDay = {
|
||||
.month = 0xff,
|
||||
.dayofweek = 1, /* mondays */
|
||||
.weekofmonth = 0xff,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
.timeValues = {
|
||||
.TV_Count = 0,
|
||||
.Time_Values = { 0 }
|
||||
},
|
||||
.priority = 16,
|
||||
};
|
||||
BACNET_SPECIAL_EVENT out = { 0 };
|
||||
|
||||
len = bacnet_special_event_encode(apdu, &in);
|
||||
null_len = bacnet_special_event_encode(NULL, &in);
|
||||
zassert_equal(len, null_len, NULL);
|
||||
|
||||
apdu_len = bacnet_special_event_decode(apdu, len, &out);
|
||||
zassert_equal(len, apdu_len, NULL);
|
||||
zassert_equal(in.periodTag, out.periodTag, NULL);
|
||||
|
||||
zassert_equal(
|
||||
in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.WeekNDay.month,
|
||||
out.period.calendarEntry.type.WeekNDay.month, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.WeekNDay.dayofweek,
|
||||
out.period.calendarEntry.type.WeekNDay.dayofweek, NULL);
|
||||
zassert_equal(in.period.calendarEntry.type.WeekNDay.weekofmonth,
|
||||
out.period.calendarEntry.type.WeekNDay.weekofmonth, NULL);
|
||||
|
||||
zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL);
|
||||
zassert_equal(in.priority, out.priority, NULL);
|
||||
}
|
||||
|
||||
/** @brief try decoding a real sample from Siemens, captured with wireshark */
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_DecodeRealAPDU)
|
||||
#else
|
||||
static void test_BACnetSpecialEvent_DecodeRealAPDU(void)
|
||||
#endif
|
||||
{
|
||||
int len, apdu_len;
|
||||
BACNET_SPECIAL_EVENT out = { 0 };
|
||||
uint8_t sample[18] = { 0x0e, 0x0c, 0xff, 0x0a, 0x1c, 0xff, 0x0f, 0x2e, 0xb4,
|
||||
0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x2f, 0x39, 0x10 };
|
||||
|
||||
apdu_len = bacnet_special_event_decode(sample, sizeof(sample), &out);
|
||||
zassert_equal(sizeof(sample), apdu_len, NULL);
|
||||
|
||||
zassert_equal(
|
||||
out.periodTag, BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, NULL);
|
||||
zassert_equal(out.period.calendarEntry.tag, BACNET_CALENDAR_DATE, NULL);
|
||||
zassert_equal(out.period.calendarEntry.type.Date.day, 28, NULL);
|
||||
zassert_equal(out.period.calendarEntry.type.Date.month, 10, NULL);
|
||||
zassert_equal(
|
||||
out.period.calendarEntry.type.Date.year, 2155 /* any */, NULL);
|
||||
zassert_equal(
|
||||
out.period.calendarEntry.type.Date.wday, 0xff /* any */, NULL);
|
||||
|
||||
zassert_equal(out.timeValues.TV_Count, 1, NULL);
|
||||
|
||||
zassert_equal(out.timeValues.Time_Values[0].Time.hour, 0, NULL);
|
||||
zassert_equal(out.timeValues.Time_Values[0].Time.min, 0, NULL);
|
||||
zassert_equal(out.timeValues.Time_Values[0].Time.sec, 0, NULL);
|
||||
zassert_equal(out.timeValues.Time_Values[0].Time.hundredths, 0, NULL);
|
||||
|
||||
zassert_equal(out.timeValues.Time_Values[0].Value.tag,
|
||||
BACNET_APPLICATION_TAG_ENUMERATED, NULL);
|
||||
zassert_equal(
|
||||
out.timeValues.Time_Values[0].Value.type.Unsigned_Int, 0, NULL);
|
||||
|
||||
zassert_equal(out.priority, 16, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_ZTEST_NEW_API)
|
||||
ZTEST_SUITE(BACnetSpecialEvent_tests, NULL, NULL, NULL, NULL, NULL);
|
||||
#else
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(BACnetSpecialEvent_tests,
|
||||
ztest_unit_test(test_BACnetSpecialEvent_CalendarRef),
|
||||
ztest_unit_test(test_BACnetSpecialEvent_Date),
|
||||
ztest_unit_test(test_BACnetSpecialEvent_DateRange),
|
||||
ztest_unit_test(test_BACnetSpecialEvent_WeekNDate),
|
||||
ztest_unit_test(test_BACnetSpecialEvent_DecodeRealAPDU));
|
||||
|
||||
ztest_run_test_suite(BACnetSpecialEvent_tests);
|
||||
}
|
||||
#endif
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/hostnport.c
|
||||
${SRC_DIR}/bacnet/lighting.c
|
||||
${SRC_DIR}/bacnet/timestamp.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/* @file
|
||||
* @brief test BACnet integer encode/decode APIs
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <zephyr/ztest.h>
|
||||
#include <bacnet/wp.h>
|
||||
|
||||
@@ -129,7 +129,8 @@ static void testWritePropertyTag(BACNET_APPLICATION_DATA_VALUE *value)
|
||||
test_value.type.Signed_Int, value->type.Signed_Int, NULL);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_REAL:
|
||||
zassert_equal(test_value.type.Real, value->type.Real, NULL);
|
||||
zassert_false(islessgreater(test_value.type.Real, value->type.Real),
|
||||
NULL);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_ENUMERATED:
|
||||
zassert_equal(
|
||||
|
||||
@@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/weeklyschedule.c
|
||||
${SRC_DIR}/bacnet/bactimevalue.c
|
||||
${SRC_DIR}/bacnet/dailyschedule.c
|
||||
${SRC_DIR}/bacnet/calendar_entry.c
|
||||
${SRC_DIR}/bacnet/special_event.c
|
||||
# Test and test library files
|
||||
./src/main.c
|
||||
${ZTST_DIR}/ztest_mock.c
|
||||
|
||||
Reference in New Issue
Block a user