dad9e13485
* [WIP] Remove unit testcases duplicated under non-unit tree * [WIP] Update west.yml to Zephyr v3.3.0 (twister verified) * Update CI to Zephyr v3.4.0 w/ reduced module set - Update zephyr/module.yml to use Zephyr v3.4.0 + cmsis; - Update tests to use ZTEST_NEW_API for zephyr builds Verified by: 1. make clean test 2. ./zephyr/scripts/twister -p unit_testing -T bacnet/zephyr/tests/bacnet --------- Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2020 Legrand North America, LLC.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
/* @file
|
|
* @brief test BACnet integer encode/decode APIs
|
|
*/
|
|
|
|
#include <zephyr/ztest.h>
|
|
#include <bacnet/basic/object/schedule.h>
|
|
|
|
/**
|
|
* @addtogroup bacnet_tests
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @brief Test
|
|
*/
|
|
#if defined(CONFIG_ZTEST_NEW_API)
|
|
ZTEST(schedule_tests, testSchedule)
|
|
#else
|
|
static void testSchedule(void)
|
|
#endif
|
|
{
|
|
BACNET_READ_PROPERTY_DATA rpdata;
|
|
uint8_t apdu[MAX_APDU] = { 0 };
|
|
int len = 0;
|
|
uint32_t len_value = 0;
|
|
uint8_t tag_number = 0;
|
|
BACNET_OBJECT_TYPE decoded_type = 0;
|
|
uint32_t decoded_instance = 0;
|
|
|
|
Schedule_Init();
|
|
rpdata.application_data = &apdu[0];
|
|
rpdata.application_data_len = sizeof(apdu);
|
|
rpdata.object_type = OBJECT_SCHEDULE;
|
|
rpdata.object_instance = 1;
|
|
rpdata.object_property = PROP_OBJECT_IDENTIFIER;
|
|
rpdata.array_index = BACNET_ARRAY_ALL;
|
|
len = Schedule_Read_Property(&rpdata);
|
|
zassert_not_equal(len, 0, NULL);
|
|
len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value);
|
|
zassert_equal(tag_number, BACNET_APPLICATION_TAG_OBJECT_ID, NULL);
|
|
len = decode_object_id(&apdu[len], &decoded_type, &decoded_instance);
|
|
zassert_equal(decoded_type, rpdata.object_type, NULL);
|
|
zassert_equal(decoded_instance, rpdata.object_instance, NULL);
|
|
|
|
return;
|
|
}
|
|
/**
|
|
* @}
|
|
*/
|
|
|
|
|
|
#if defined(CONFIG_ZTEST_NEW_API)
|
|
ZTEST_SUITE(schedule_tests, NULL, NULL, NULL, NULL, NULL);
|
|
#else
|
|
void test_main(void)
|
|
{
|
|
ztest_test_suite(schedule_tests,
|
|
ztest_unit_test(testSchedule)
|
|
);
|
|
|
|
ztest_run_test_suite(schedule_tests);
|
|
}
|
|
#endif
|