Skip to content

Commit

Permalink
prevent stuff clashing in the UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
FrogTheFrog committed Aug 12, 2024
1 parent e441a20 commit 49ecba6
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tests/unit/test_display_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace {
};
} // namespace

namespace {
namespace test_parse_device_id {
using ParseDeviceId = DisplayDeviceConfigTest<std::pair<std::string, std::string>>;
INSTANTIATE_TEST_SUITE_P(
DisplayDeviceTest,
Expand All @@ -37,7 +37,7 @@ namespace {
std::make_pair(""s, ""s),
std::make_pair("SomeId"s, "SomeId"s),
std::make_pair("{daeac860-f4db-5208-b1f5-cf59444fb768}"s, "{daeac860-f4db-5208-b1f5-cf59444fb768}"s)));
TEST_P(ParseDeviceId, BasicTest) {
TEST_P(ParseDeviceId, GeneralTest) {
const auto &[input_value, expected_value] = GetParam();

config::video_t video_config {};
Expand All @@ -47,9 +47,9 @@ namespace {
const auto result { display_device::parse_configuration(video_config, {}) };
EXPECT_EQ(std::get<display_device::SingleDisplayConfiguration>(result).m_device_id, expected_value);
}
} // namespace
} // namespace test_parse_device_id

namespace {
namespace test_parse_config_option {
using ParseConfigOption = DisplayDeviceConfigTest<std::pair<config_option_e, std::optional<DevicePreparation>>>;
INSTANTIATE_TEST_SUITE_P(
DisplayDeviceTest,
Expand All @@ -60,7 +60,7 @@ namespace {
std::make_pair(config_option_e::ensure_active, DevicePreparation::EnsureActive),
std::make_pair(config_option_e::ensure_primary, DevicePreparation::EnsurePrimary),
std::make_pair(config_option_e::ensure_only_display, DevicePreparation::EnsureOnlyDisplay)));
TEST_P(ParseConfigOption, BasicTest) {
TEST_P(ParseConfigOption, GeneralTest) {
const auto &[input_value, expected_value] = GetParam();

config::video_t video_config {};
Expand All @@ -74,9 +74,9 @@ namespace {
ASSERT_EQ(std::get_if<display_device::configuration_disabled_tag_t>(&result) != nullptr, !expected_value);
}
}
} // namespace
} // namespace test_parse_config_option

namespace {
namespace test_parse_hdr_option {
using client_wants_hdr = bool;
using ParseHdrOption = DisplayDeviceConfigTest<std::pair<std::pair<hdr_option_e, client_wants_hdr>, std::optional<HdrState>>>;
INSTANTIATE_TEST_SUITE_P(
Expand All @@ -87,7 +87,7 @@ namespace {
std::make_pair(std::make_pair(hdr_option_e::disabled, client_wants_hdr { false }), std::nullopt),
std::make_pair(std::make_pair(hdr_option_e::automatic, client_wants_hdr { true }), HdrState::Enabled),
std::make_pair(std::make_pair(hdr_option_e::automatic, client_wants_hdr { false }), HdrState::Disabled)));
TEST_P(ParseHdrOption, BasicTest) {
TEST_P(ParseHdrOption, GeneralTest) {
const auto &[input_value, expected_value] = GetParam();
const auto &[input_hdr_option, input_enable_hdr] = input_value;

Expand All @@ -101,9 +101,9 @@ namespace {
const auto result { display_device::parse_configuration(video_config, session) };
EXPECT_EQ(std::get<display_device::SingleDisplayConfiguration>(result).m_hdr_state, expected_value);
}
} // namespace
} // namespace test_parse_hdr_option

namespace {
namespace test_parse_resolution_option {
struct failed_to_parse_resolution_t {};
struct no_resolution_t {};

Expand Down Expand Up @@ -162,7 +162,7 @@ namespace {
std::make_pair(std::make_tuple(resolution_option_e::manual, sops_enabled { true }, max_uint_string + "x"s + max_uint_string), Resolution { max_uint, max_uint }),
std::make_pair(std::make_tuple(resolution_option_e::manual, sops_enabled { true }, max_uint_string + "0"s + "x"s + max_uint_string), failed_to_parse_resolution_t {}),
std::make_pair(std::make_tuple(resolution_option_e::manual, sops_enabled { true }, max_uint_string + "x"s + max_uint_string + "0"s), failed_to_parse_resolution_t {})));
TEST_P(ParseResolutionOption, BasicTest) {
TEST_P(ParseResolutionOption, GeneralTest) {
const auto &[input_value, expected_value] = GetParam();
const auto &[input_resolution_option, input_enable_sops, input_resolution] = input_value;

Expand Down Expand Up @@ -197,9 +197,9 @@ namespace {
EXPECT_EQ(std::get<display_device::SingleDisplayConfiguration>(result).m_resolution, expected_resolution);
}
}
} // namespace
} // namespace test_parse_resolution_option

namespace {
namespace test_parse_refresh_rate_option {
struct failed_to_parse_refresh_rate_t {};
struct no_refresh_rate_t {};

Expand Down Expand Up @@ -252,7 +252,7 @@ namespace {
std::make_pair(std::make_tuple(refresh_rate_option_e::manual, max_uint_string.substr(0, 1) + "."s + max_uint_string.substr(1)), Rational { max_uint, static_cast<unsigned int>(std::pow(10, max_uint_string.size() - 1)) }),
std::make_pair(std::make_tuple(refresh_rate_option_e::manual, max_uint_string.substr(0, 1) + "0"s + "."s + max_uint_string.substr(1)), failed_to_parse_refresh_rate_t {}),
std::make_pair(std::make_tuple(refresh_rate_option_e::manual, max_uint_string.substr(0, 1) + "."s + "0"s + max_uint_string.substr(1)), failed_to_parse_refresh_rate_t {})));
TEST_P(ParseRefreshRateOption, BasicTest) {
TEST_P(ParseRefreshRateOption, GeneralTest) {
const auto &[input_value, expected_value] = GetParam();
const auto &[input_refresh_rate_option, input_refresh_rate] = input_value;

Expand Down Expand Up @@ -283,4 +283,4 @@ namespace {
EXPECT_EQ(std::get<display_device::SingleDisplayConfiguration>(result).m_refresh_rate, expected_refresh_rate);
}
}
} // namespace
} // namespace test_parse_refresh_rate_option

0 comments on commit 49ecba6

Please sign in to comment.