release-0.4.0 #28

Merged
ismail merged 15 commits from release-0.4.0 into main 2025-07-07 13:45:02 +02:00
11 changed files with 2100 additions and 9 deletions
Showing only changes of commit 41c292cc89 - Show all commits

13
app_test/CMakeLists.txt Normal file
View File

@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.5)
# Define component search paths
# IMPORTANT: We should tell to the ESP-IDF
# where it can find relay_chn component.
# We add the 'relay_chn' directory to the COMPONENT_DIRS by specifying: ../relay_chn
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../relay_chn")
# Include ESP-IDF project build system
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# Define the name of this project
project(relay_chn_app_test)

View File

@@ -0,0 +1,3 @@
idf_component_register(SRCS "test_relay_chn.c"
INCLUDE_DIRS "."
REQUIRES unity relay_chn)

View File

@@ -2,6 +2,9 @@
#include "unity.h"
#include "unity_test_utils.h"
#include "relay_chn.h"
#include <esp_log.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
const gpio_num_t gpio_map[] = {GPIO_NUM_4, GPIO_NUM_5, GPIO_NUM_18, GPIO_NUM_19};
@@ -27,7 +30,7 @@ void tearDown(void) {
for (uint8_t i = 0; i < relay_chn_count; i++) {
relay_chn_stop(i);
}
vTaskDelay(pdMS_to_TICKS(100));
vTaskDelay(pdMS_TO_TICKS(100));
}
TEST_CASE("Relay channels run forward and update state", "[relay_chn][forward]")
@@ -90,4 +93,12 @@ TEST_CASE("Relay channels do not change state for invalid channel", "[relay_chn]
relay_chn_flip_direction(relay_chn_count);
check_channels_state_unchanged();
}
void app_main(void) {
ESP_LOGI("APP_MAIN", "Starting relay_chn unit tests...");
unity_run_all_tests();
ESP_LOGI("APP_MAIN", "All relay_chn tests completed. Restarting in 10 seconds...");
vTaskDelay(pdMS_TO_TICKS(10000));
esp_restart();
}

2072
app_test/sdkconfig Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +0,0 @@
# Create a component for test component
idf_component_register(SRCS_DIRS "."
INCLUDE_DIRS "."
REQUIRES unity relay_chn)
# Mark this as a test component
# 'relay_chn' is the name of the main component.
idf_build_set_property(TEST_COMPONENTS "relay_chn" APPEND)