diff --git a/include/faker-cxx/Food.h b/include/faker-cxx/Food.h index 5dfe72e58..949f152ce 100644 --- a/include/faker-cxx/Food.h +++ b/include/faker-cxx/Food.h @@ -2,10 +2,12 @@ #include -namespace faker { +namespace faker +{ + +class Food +{ -class Food { - public: /** * @brief Returns a random alcoholic beverage name. diff --git a/include/faker-cxx/Person.h b/include/faker-cxx/Person.h index 243a9e347..4af37e462 100644 --- a/include/faker-cxx/Person.h +++ b/include/faker-cxx/Person.h @@ -195,5 +195,29 @@ class Person */ static std::string nationality(); + + /** + * @brief Returns a random Western Zodiac + * + * @returns Western Zodiac + * + * @code + * Person::westernZodiac() // "Virgo" + * @endcode + */ + + static std::string westernZodiac(); + + /** + * @brief Returns a random Chinese Zodiac + * + * @returns Chinese Zodiac + * + * @code + * Person::chineseZodiac() // "Dragon" + * @endcode + */ + + static std::string chineseZodiac(); }; } diff --git a/src/modules/person/Person.cpp b/src/modules/person/Person.cpp index 0077baa91..ffe9d98e9 100644 --- a/src/modules/person/Person.cpp +++ b/src/modules/person/Person.cpp @@ -22,6 +22,7 @@ #include "data/turkish/TurkishPeopleNames.h" #include "faker-cxx/Helper.h" #include "fmt/format.h" +#include "data/ZodiacSigns.h" namespace faker { @@ -396,4 +397,14 @@ std::string suffixForLanguage(Language language, std::optional sex) return Helper::arrayElement(suffixes); } } + +std::string Person::westernZodiac() +{ + return Helper::arrayElement(westernZodiacs); +} + +std::string Person::chineseZodiac() +{ + return Helper::arrayElement(chineseZodiacs); } +} \ No newline at end of file diff --git a/src/modules/person/PersonTest.cpp b/src/modules/person/PersonTest.cpp index 832e9926c..bd17bd111 100644 --- a/src/modules/person/PersonTest.cpp +++ b/src/modules/person/PersonTest.cpp @@ -15,6 +15,7 @@ #include "data/italian/ItalianPeopleNames.h" #include "data/JobTitles.h" #include "data/Nationalities.h" +#include "data/ZodiacSigns.h" #include "data/nepalese/NepalesePeopleNames.h" #include "data/polish/PolishPeopleNames.h" #include "data/romanian/RomanianPeopleNames.h" @@ -383,3 +384,20 @@ TEST_F(PersonTest, shouldGenerateNationality) ASSERT_TRUE(std::ranges::any_of(nationalities, [generatedNationality](const std::string& nationality) { return generatedNationality == nationality; })); } + +TEST_F(PersonTest, shouldGenerateWesternZodiacs) +{ + const auto generatedWesternZodiacs = Person::westernZodiac(); + + ASSERT_TRUE(std::ranges::any_of(westernZodiacs, [generatedWesternZodiacs](const std::string& westernZodiac) + { return generatedWesternZodiacs == westernZodiac;})); + +} + +TEST_F(PersonTest, shouldGenerateChineseZodiacs) +{ + const auto generatedChineseZodiacs = Person::chineseZodiac(); + + ASSERT_TRUE(std::ranges::any_of(chineseZodiacs, [generatedChineseZodiacs](const std::string& chineseZodiac) + { return generatedChineseZodiacs == chineseZodiac;})); +} \ No newline at end of file diff --git a/src/modules/person/data/ZodiacSigns.h b/src/modules/person/data/ZodiacSigns.h new file mode 100644 index 000000000..95fcd13a3 --- /dev/null +++ b/src/modules/person/data/ZodiacSigns.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include + + +const std::vector westernZodiacs = { + "Aries", + "Taurus", + "Gemini", + "Cancer", + "Leo", + "Virgo", + "Libra", + "Scorpio", + "Sagittarius", + "Capricorn", + "Aquarius", + "Pisces" +}; + +const std::vector chineseZodiacs = { + "Rat", + "Ox", + "Tiger", + "Rabbit", + "Dragon", + "Snake" + "Horse", + "Sheep", + "Monkey" + "Rooster", + "Dog", + "Pig" +}; \ No newline at end of file