diff --git a/include/faker-cxx/Medicine.h b/include/faker-cxx/Medicine.h index 46e58d46e..9921d6fe3 100644 --- a/include/faker-cxx/Medicine.h +++ b/include/faker-cxx/Medicine.h @@ -2,44 +2,39 @@ #include -namespace faker +namespace faker::medicine { -class Medicine -{ - -public: - /** - * @brief Returns a random medical condition. - * - * @returns Medical condition. - * - * @code - * Medicine::condition() // "AIDS" - * @endcode - */ - static std::string_view condition(); +/** + * @brief Returns a random medical condition. + * + * @returns Medical condition. + * + * @code + * medicine::condition() // "AIDS" + * @endcode + */ +std::string_view condition(); - /** - * @brief Returns a random medical test - * - * @returns Medical test. - * - * @code - * Medicine::medicalTest() // "pulmonary auscultation" - * @endcode - */ - static std::string_view medicalTest(); +/** + * @brief Returns a random medical test + * + * @returns Medical test. + * + * @code + * medicine::medicalTest() // "pulmonary auscultation" + * @endcode + */ +std::string_view medicalTest(); - /** - * @brief Returns a random Medical specialty - * - * @returns Medical specialty. - * - * @code - * Medicine::specialty() // "Cardiology" - * @endcode - */ +/** + * @brief Returns a random Medical specialty + * + * @returns Medical specialty. + * + * @code + * medicine::specialty() // "Cardiology" + * @endcode + */ - static std::string_view specialty(); -}; +std::string_view specialty(); } diff --git a/src/modules/medicine/Medicine.cpp b/src/modules/medicine/Medicine.cpp index 085e25cd2..0a2906739 100644 --- a/src/modules/medicine/Medicine.cpp +++ b/src/modules/medicine/Medicine.cpp @@ -5,21 +5,21 @@ #include "faker-cxx/Helper.h" #include "MedicineData.h" -namespace faker +namespace faker::medicine { -std::string_view Medicine::condition() +std::string_view condition() { - return Helper::arrayElement(medicine::medicalConditions); + return Helper::arrayElement(medicalConditions); } -std::string_view Medicine::medicalTest() +std::string_view medicalTest() { - return Helper::arrayElement(medicine::medicalTests); + return Helper::arrayElement(medicalTests); } -std::string_view Medicine::specialty() +std::string_view specialty() { - return Helper::arrayElement(medicine::specialties); + return Helper::arrayElement(specialties); } } diff --git a/src/modules/medicine/MedicineData.h b/src/modules/medicine/MedicineData.h index ae37e9b08..56d40bc45 100644 --- a/src/modules/medicine/MedicineData.h +++ b/src/modules/medicine/MedicineData.h @@ -64,7 +64,7 @@ const auto medicalConditions = std::to_array({ "Thalassemia Major", "Tuberculosis", "Ulcerative Colitis", - "Ulcers, Stomach or Intestinal" + "Ulcers, Stomach or Intestinal", }); const auto medicalTests = std::to_array({ @@ -102,7 +102,7 @@ const auto medicalTests = std::to_array({ "skin biopsy", "thoracentesis", "urodynamic testing", - "vaginal examination" + "vaginal examination", }); const auto specialties = std::to_array({ @@ -160,7 +160,6 @@ const auto specialties = std::to_array({ "Tropical medicine", "Urology", "Vascular surgery", - "Venereology" + "Venereology", }); - } diff --git a/tests/modules/medicine/MedicineTest.cpp b/tests/modules/medicine/MedicineTest.cpp index fafe243d9..645d10a06 100644 --- a/tests/modules/medicine/MedicineTest.cpp +++ b/tests/modules/medicine/MedicineTest.cpp @@ -8,7 +8,7 @@ #include "medicine/MedicineData.h" using namespace ::testing; -using namespace faker; +using namespace faker::medicine; class MedicineTest : public Test { @@ -17,25 +17,25 @@ class MedicineTest : public Test TEST_F(MedicineTest, shouldGenerateMedicalCondition) { - const auto generatedMedicalCondition = Medicine::condition(); + const auto generatedMedicalCondition = condition(); - ASSERT_TRUE(std::ranges::any_of(medicine::medicalConditions, + ASSERT_TRUE(std::ranges::any_of(medicalConditions, [generatedMedicalCondition](const std::string_view& medicalCondition) { return medicalCondition == generatedMedicalCondition; })); } TEST_F(MedicineTest, shouldGenerateMedicalTest) { - const auto generatedMedicalTest = Medicine::medicalTest(); + const auto generatedMedicalTest = medicalTest(); - ASSERT_TRUE(std::ranges::any_of(medicine::medicalTests, [generatedMedicalTest](const std::string_view& medicalTest) + ASSERT_TRUE(std::ranges::any_of(medicalTests, [generatedMedicalTest](const std::string_view& medicalTest) { return medicalTest == generatedMedicalTest; })); } TEST_F(MedicineTest, shouldGenerateSpecialty) { - const auto generatedSpecialty = Medicine::specialty(); + const auto generatedSpecialty = specialty(); - ASSERT_TRUE(std::ranges::any_of(medicine::specialties, [generatedSpecialty](const std::string_view& specialty) + ASSERT_TRUE(std::ranges::any_of(specialties, [generatedSpecialty](const std::string_view& specialty) { return specialty == generatedSpecialty; })); }