Add and execute unit tests for run limit feature
This commit is contained in:
@@ -28,6 +28,7 @@ void tearDown()
|
||||
reset_channels_to_idle_state();
|
||||
}
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
static void test_nvs_flash_init(void)
|
||||
{
|
||||
esp_err_t ret;
|
||||
@@ -52,9 +53,11 @@ static void test_nvs_flash_init(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
TEST_ESP_OK(ret);
|
||||
TEST_ESP_OK(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
static void test_nvs_flash_deinit(void)
|
||||
{
|
||||
esp_err_t ret;
|
||||
@@ -65,11 +68,14 @@ static void test_nvs_flash_deinit(void)
|
||||
#endif
|
||||
TEST_ESP_OK(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
// Init NVS once for all tests
|
||||
test_nvs_flash_init();
|
||||
#endif
|
||||
|
||||
// Create relay_chn once for all tests
|
||||
TEST_ESP_OK(relay_chn_create(gpio_map, gpio_count));
|
||||
@@ -92,8 +98,10 @@ void app_main(void)
|
||||
// Destroy relay_chn
|
||||
relay_chn_destroy();
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
// Deinit NVS
|
||||
test_nvs_flash_deinit();
|
||||
#endif
|
||||
|
||||
ESP_LOGI(TEST_TAG, "All tests complete.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user