Refactored app_config unit tests
This commit is contained in:
parent
4686a42256
commit
c94b00a10b
@ -220,9 +220,10 @@ static void common_tests(app_config &config, provider_type prov) {
|
||||
[](app_config &cfg) {
|
||||
test_getter_setter(cfg, &app_config::get_download_timeout_secs,
|
||||
&app_config::set_download_timeout_secs,
|
||||
min_download_timeout_secs,
|
||||
std::uint8_t{min_download_timeout_secs + 1U},
|
||||
JSON_DOWNLOAD_TIMEOUT_SECS, "26");
|
||||
std::uint8_t{min_download_timeout_secs + 2U},
|
||||
JSON_DOWNLOAD_TIMEOUT_SECS,
|
||||
std::to_string(min_download_timeout_secs + 2U));
|
||||
|
||||
cfg.set_download_timeout_secs(min_download_timeout_secs - 1U);
|
||||
EXPECT_EQ(min_download_timeout_secs, cfg.get_download_timeout_secs());
|
||||
@ -283,6 +284,9 @@ static void common_tests(app_config &config, provider_type prov) {
|
||||
std::uint16_t{default_high_freq_interval_secs + 2U},
|
||||
JSON_HIGH_FREQ_INTERVAL_SECS,
|
||||
std::to_string(default_high_freq_interval_secs + 3U));
|
||||
|
||||
cfg.set_high_frequency_interval_secs(0U);
|
||||
EXPECT_EQ(1U, cfg.get_high_frequency_interval_secs());
|
||||
}},
|
||||
{JSON_HOST_CONFIG, [](auto &&cfg) {}},
|
||||
{JSON_LOW_FREQ_INTERVAL_SECS,
|
||||
@ -294,9 +298,27 @@ static void common_tests(app_config &config, provider_type prov) {
|
||||
std::uint16_t{default_low_freq_interval_secs + 2U},
|
||||
JSON_LOW_FREQ_INTERVAL_SECS,
|
||||
std::to_string(default_low_freq_interval_secs + 3U));
|
||||
|
||||
cfg.set_low_frequency_interval_secs(0U);
|
||||
EXPECT_EQ(1U, cfg.get_low_frequency_interval_secs());
|
||||
}},
|
||||
{JSON_MAX_CACHE_SIZE_BYTES,
|
||||
[](app_config &cfg) {
|
||||
test_getter_setter(
|
||||
cfg, &app_config::get_max_cache_size_bytes,
|
||||
&app_config::set_max_cache_size_bytes, min_cache_size_bytes + 1U,
|
||||
min_cache_size_bytes + 2U, JSON_MAX_CACHE_SIZE_BYTES,
|
||||
std::to_string(min_cache_size_bytes + 3U));
|
||||
|
||||
cfg.set_max_cache_size_bytes(min_cache_size_bytes - 1U);
|
||||
EXPECT_EQ(min_cache_size_bytes, cfg.get_max_cache_size_bytes());
|
||||
}},
|
||||
{JSON_MAX_UPLOAD_COUNT,
|
||||
[](auto &&cfg) {
|
||||
test_getter_setter(cfg, &app_config::get_max_upload_count,
|
||||
&app_config::set_max_upload_count, std::uint8_t{1U},
|
||||
std::uint8_t{2U}, JSON_MAX_UPLOAD_COUNT, "3");
|
||||
}},
|
||||
{JSON_MAX_CACHE_SIZE_BYTES, [](auto &&cfg) {}},
|
||||
{JSON_MAX_UPLOAD_COUNT, [](auto &&cfg) {}},
|
||||
{JSON_MED_FREQ_INTERVAL_SECS,
|
||||
[](app_config &cfg) {
|
||||
test_getter_setter(
|
||||
@ -306,6 +328,9 @@ static void common_tests(app_config &config, provider_type prov) {
|
||||
std::uint16_t{default_med_freq_interval_secs + 2U},
|
||||
JSON_MED_FREQ_INTERVAL_SECS,
|
||||
std::to_string(default_med_freq_interval_secs + 3U));
|
||||
|
||||
cfg.set_med_frequency_interval_secs(0U);
|
||||
EXPECT_EQ(1U, cfg.get_med_frequency_interval_secs());
|
||||
}},
|
||||
{JSON_ONLINE_CHECK_RETRY_SECS, [](auto &&cfg) {}},
|
||||
{JSON_ORPHANED_FILE_RETENTION_DAYS, [](auto &&cfg) {}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user