Files
bacnet_stack/test/bacnet/basic/object/time_value/src/main.c
T
Kari Argillander f806c5829b Run clang-format and enable CI check for it (#755)
* pre-commit: Update and enable clang-format check

There is newer version from clang-format so use that. We do not yet want
18 as that is little bit too new.

* Format some thing by hand which clang-format "breaks"

Clang-format will format some things little bit off in some cases.
Format some things by hand so we get cleaner end result.

* Run clang-format with

```
pre-commit run --all-files clang-format
```

We have already in previously checked places where clang-format does not
make good format and ignored those (hopefully most of the things).

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2024-08-30 11:20:58 -05:00

63 lines
1.6 KiB
C

/**
* @file
* @brief Unit test for BACnet Time Value object encode/decode APIs
* @author Mikhail Antropov <michail.antropov@dsr-corporation.com>
* @author Steve Karg <skarg@users.sourceforge.net>
* @date June 2023
*
* SPDX-License-Identifier: MIT
*/
#include <zephyr/ztest.h>
#include <bacnet/basic/object/time_value.h>
#include <bacnet/bactext.h>
#include <property_test.h>
/**
* @addtogroup bacnet_tests
* @{
*/
/**
* @brief Test Time Value handling
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST(bacnet_tv, testTimeValue)
#else
static void testTimeValue(void)
#endif
{
bool status = false;
unsigned count = 0;
uint32_t object_instance = 0;
const int skip_fail_property_list[] = { -1 };
Time_Value_Init();
object_instance = Time_Value_Create(BACNET_MAX_INSTANCE);
count = Time_Value_Count();
zassert_true(count > 0, NULL);
object_instance = Time_Value_Index_To_Instance(0);
bacnet_object_properties_read_write_test(
OBJECT_TIME_VALUE, object_instance, Time_Value_Property_Lists,
Time_Value_Read_Property, Time_Value_Write_Property,
skip_fail_property_list);
bacnet_object_name_ascii_test(
object_instance, Time_Value_Name_Set, Time_Value_Name_ASCII);
/* check the delete function */
status = Time_Value_Delete(object_instance);
zassert_true(status, NULL);
}
/**
* @}
*/
#ifdef CONFIG_ZTEST_NEW_API
ZTEST_SUITE(bacnet_tv, NULL, NULL, NULL, NULL, NULL);
#else
void test_main(void)
{
ztest_test_suite(tv_tests, ztest_unit_test(testTimeValue));
ztest_run_test_suite(tv_tests);
}
#endif