Skip to content

Commit

Permalink
test: weather module
Browse files Browse the repository at this point in the history
* weather module test case fixed

Signed-off-by: Guru Mehar Rachaputi <[email protected]>
  • Loading branch information
00thirdeye00 committed Sep 27, 2024
1 parent 91e8726 commit 42ff861
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
24 changes: 2 additions & 22 deletions src/modules/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,18 @@

#include "faker-cxx/helper.h"
#include "weather_data.h"
#include <span>

namespace faker::weather
{
namespace
{
const auto& getWeatherDefinition(Locale locale)
const std::span<const std::string_view> 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;
}
Expand Down
27 changes: 4 additions & 23 deletions tests/modules/weather_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,20 @@
#include "faker-cxx/types/locale.h"
#include "faker-cxx/weather.h"
#include "weather_data.h"
#include <span>

using namespace ::testing;
using namespace faker;
using namespace faker::weather;

namespace
{
const auto& getWeatherDefinition(Locale locale)
const std::span<const std::string_view> 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;
}
Expand All @@ -50,7 +31,7 @@ class WeatherTest : public TestWithParam<Locale>
public:
};

TEST_F(WeatherTest, shouldGenerateWeatherDescription)
TEST_P(WeatherTest, shouldGenerateWeatherDescription)
{

const auto locale = GetParam();
Expand Down

0 comments on commit 42ff861

Please sign in to comment.