Commit Graph

21 Commits

Author SHA1 Message Date
5afefc4dc0 Use original names for config parameters
The config parameter names defined in the relay_chn_defs.h file
have been changed back to their original names (with the CONFIG_ prefix),
so that they are not confused with application-level defines.

Refs #1085
2025-08-25 10:24:13 +03:00
cb38f71d8e Optimize a flip test case and execute tests upon removing esp_event 2025-08-22 17:42:24 +03:00
fb4f34e895 Add and execute unit tests for run limit feature 2025-08-22 12:42:53 +03:00
29803c063e Enhance unit test default sdkconfig files
The sdkconfig.defaults files were enhanced to test the component against all individual configurations for more granularity, as well as with all combinations to ensure consistency and integrity across all configurations.
2025-08-22 12:41:58 +03:00
b99622bd23 Fix and document tilt key names.
Fix key names with more approprite ones and add documentation for them. Fixes #1081.
2025-08-20 11:17:40 +03:00
aeeda44a2c Optimize and refactor tilt counting
- Optimized tilt counting data by reducing the tilt counter variables into one for smaller memory footprint. So the `relay_chn_tilt_counter_t` type is replaced by a single `uint16_t` variable in the `relay_chn_tilt_ctl_t` structure. Hence the `relay_chn_tilt_counter_t` type has been removed since it is not necessary anymore.
- Refactored tilt count handling in NVS: consolidate forward and reverse counts into a single tilt count parameter.
- Updated NVS test files that affected by the data type and function signature changes.

Fixes #1079
2025-08-20 11:07:50 +03:00
61edf11b75 Refactor to remove redundant initialization and add NVS storage tests
- Removed unnecessary calls to relay_chn_create and g_is_component_initialized in multiple test cases across test_relay_chn_core_single.c, test_relay_chn_listener_multi.c, and test_relay_chn_listener_single.c.
- Introduced new test files for NVS functionality: test_relay_chn_nvs_multi.c and test_relay_chn_nvs_single.c, covering initialization, direction setting, invalid parameters, and erase operations.
- Updated partition table configuration to support NVS storage, including the addition of a new partition file part_nvs.csv.
- Adjusted sdkconfig files to enable NVS support and configure custom partition settings for relay channels.
2025-08-19 17:36:23 +03:00
f04632dc77 Unignore .vscode folder.
Unignore .vscode folder and add necessary configuration files for a
synced development environment.
2025-08-14 16:55:25 +03:00
f8d6e74f23 Refactor and update configuration for single channel mode
- Created `test_relay_chn_tilt_multi.c` and `test_relay_chn_tilt_single.c` to implement comprehensive tests for the tilt functionality of relay channels, covering various scenarios including transitions between states and sensitivity settings.
- Introduced a new partition table in `partitionTable.csv` for proper memory management.
- Updated `sdkconfig` to set the relay channel count to 1 for single channel testing and adjusted related configurations.
- Added default configuration file `sdkconfig.defaults.single` for streamlined testing setup.
2025-08-13 18:36:48 +03:00
d884f5f45c Add missing test cases for tilt API.
Added missing test cases for the tilt API.

Closes #1056.
2025-07-22 10:02:40 +03:00
c7678d6084 Add restart chip to make qemu exit in tests. 2025-07-22 10:00:33 +03:00
a143484748 Break down tests into categories.
Break down tests into categories to improve maintainability and test granularity. This makes it easier to execute unit tests in CI/CD pipelines.

Closes #1054.
2025-07-21 15:37:49 +03:00
a9a8169710 Add test cases for ID_ALL channel id.
Add test cases to test all relevant functions that support operating with the `RELAY_CHN_ID_ALL` channel id.

Closes #1052.
2025-07-16 11:42:44 +03:00
74f4341c1d Add test cases for direction flip.
Closes #1051.
2025-07-15 16:14:19 +03:00
a587036093 Add tests for init error handling.
Added tests for covering initialization error handling cases like; NULL pointer, invalid GPIO count etc.

This changed implied removing the `relay_chn_create` from the Unity's `setUp` function and place it in each testcase.

Refs #1050, #1030.
2025-07-15 12:23:21 +03:00
db62a7b5b2 Fix listener memory allocation bug.
- Replaced the buggy, oldschool, plain pointer based list approach with more robust FreeRTOS linked list implementation for the listener API. Fixes #1049.

- Added relevant test cases. Refs #1030.
2025-07-14 18:49:47 +03:00
1ee70be715 Fix invalid ID test loops. 2025-07-14 18:49:47 +03:00
f1cb928341 Add missing destroy function.
The component allocates resources (timers, event loop) in relay_chn_create but never frees them. This is a resource leak.
Hence, a destroy function added to free the resources gracefully.

Fixes #1048.
2025-07-14 11:37:14 +03:00
a90649a4d3 Clean and add more tests.
Clean the unnecessary codes and logging macros to keep the test output cleaner.
Add fail tests for the `get_state*` functions.
2025-07-11 18:32:28 +03:00
9b2274ed7c Add default configs for unit tests. 2025-07-11 17:35:50 +03:00
5a38956146 Restructure the project tree.
Restructured the project tree to align with Espressif's project tree pattern and practice. Also updated the affected cmake files.

Fixes: #1033
2025-07-07 22:57:02 +03:00