Fix config parameters check
Unnecessary `#if CONFIG_FOO == 1` checks were removed and the statements were simplified to` #if CONFIG_FOO`. `#ifdef CONFIG_FOO` statements were also changed to `#if CONFIG_FOO` to keep the style as uniform as possible. Refs #1085
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "unity_test_runner.h"
|
||||
#include "test_common.h"
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
#include "nvs_flash.h"
|
||||
#include "relay_chn_nvs.h"
|
||||
#endif
|
||||
@@ -28,11 +28,11 @@ void tearDown()
|
||||
reset_channels_to_idle_state();
|
||||
}
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
static void test_nvs_flash_init(void)
|
||||
{
|
||||
esp_err_t ret;
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION == 1
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION
|
||||
ret = nvs_flash_init_partition(CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION_NAME);
|
||||
ESP_LOGI(TEST_TAG, "test_nvs_flash_init: NVS flash init partition return: %s", esp_err_to_name(ret));
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
@@ -57,11 +57,11 @@ TEST_ESP_OK(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
static void test_nvs_flash_deinit(void)
|
||||
{
|
||||
esp_err_t ret;
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION == 1
|
||||
#if CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION
|
||||
ret = nvs_flash_deinit_partition(CONFIG_RELAY_CHN_NVS_CUSTOM_PARTITION_NAME);
|
||||
#else
|
||||
ret = nvs_flash_deinit();
|
||||
@@ -72,7 +72,7 @@ static void test_nvs_flash_deinit(void)
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
// Init NVS once for all tests
|
||||
test_nvs_flash_init();
|
||||
#endif
|
||||
@@ -98,7 +98,7 @@ void app_main(void)
|
||||
// Destroy relay_chn
|
||||
relay_chn_destroy();
|
||||
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS == 1
|
||||
#if CONFIG_RELAY_CHN_ENABLE_NVS
|
||||
// Deinit NVS
|
||||
test_nvs_flash_deinit();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user