From 42ff86181aa26b2c2e3efe22c77d286ba26e677d Mon Sep 17 00:00:00 2001 From: Guru Mehar Rachaputi Date: Fri, 27 Sep 2024 17:03:52 +0200 Subject: [PATCH] test: weather module * weather module test case fixed Signed-off-by: Guru Mehar Rachaputi --- src/modules/weather.cpp | 24 ++---------------------- tests/modules/weather_test.cpp | 27 ++++----------------------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/src/modules/weather.cpp b/src/modules/weather.cpp index f26f1610d..49ecd921f 100644 --- a/src/modules/weather.cpp +++ b/src/modules/weather.cpp @@ -4,38 +4,18 @@ #include "faker-cxx/helper.h" #include "weather_data.h" +#include namespace faker::weather { namespace { -const auto& getWeatherDefinition(Locale locale) +const std::span getWeatherDefinition(Locale locale) { switch (locale) { case Locale::sv_SE: return svSEWeatherDescriptions; - case Locale::en_029: - case Locale::en_AU: - case Locale::en_BW: - case Locale::en_BZ: - case Locale::en_CA: - case Locale::en_cb: - case Locale::en_GB: - case Locale::en_GH: - case Locale::en_HK: - case Locale::en_IE: - case Locale::en_IN: - case Locale::en_JM: - case Locale::en_MT: - case Locale::en_MY: - case Locale::en_NZ: - case Locale::en_PH: - case Locale::en_SG: - case Locale::en_TT: - case Locale::en_US: - case Locale::en_ZA: - case Locale::en_ZW: default: return enUSWeatherDescriptions; } diff --git a/tests/modules/weather_test.cpp b/tests/modules/weather_test.cpp index bd4080657..071be51d5 100644 --- a/tests/modules/weather_test.cpp +++ b/tests/modules/weather_test.cpp @@ -6,39 +6,20 @@ #include "faker-cxx/types/locale.h" #include "faker-cxx/weather.h" #include "weather_data.h" +#include using namespace ::testing; +using namespace faker; using namespace faker::weather; namespace { -const auto& getWeatherDefinition(Locale locale) +const std::span getWeatherDefinition(Locale locale) { switch (locale) { case Locale::sv_SE: return svSEWeatherDescriptions; - case Locale::en_029: - case Locale::en_AU: - case Locale::en_BW: - case Locale::en_BZ: - case Locale::en_CA: - case Locale::en_cb: - case Locale::en_GB: - case Locale::en_GH: - case Locale::en_HK: - case Locale::en_IE: - case Locale::en_IN: - case Locale::en_JM: - case Locale::en_MT: - case Locale::en_MY: - case Locale::en_NZ: - case Locale::en_PH: - case Locale::en_SG: - case Locale::en_TT: - case Locale::en_US: - case Locale::en_ZA: - case Locale::en_ZW: default: return enUSWeatherDescriptions; } @@ -50,7 +31,7 @@ class WeatherTest : public TestWithParam public: }; -TEST_F(WeatherTest, shouldGenerateWeatherDescription) +TEST_P(WeatherTest, shouldGenerateWeatherDescription) { const auto locale = GetParam();