diff --git a/CMakeLists.txt b/CMakeLists.txt index 064a7af1d..c3f883db3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ set(FAKER_SOURCES src/modules/hacker/Hacker.cpp src/modules/sport/Sport.cpp src/modules/videoGame/VideoGame.cpp + src/modules/medicine/Medicine.cpp ) set(FAKER_UT_SOURCES @@ -74,6 +75,7 @@ set(FAKER_UT_SOURCES src/modules/hacker/HackerTest.cpp src/modules/sport/SportTest.cpp src/modules/videoGame/VideoGameTest.cpp + src/modules/medicine/MedicineTest.cpp ) add_library(${LIBRARY_NAME} ${FAKER_SOURCES}) diff --git a/include/faker-cxx/Medicine.h b/include/faker-cxx/Medicine.h new file mode 100644 index 000000000..dedb7fe6b --- /dev/null +++ b/include/faker-cxx/Medicine.h @@ -0,0 +1,47 @@ +#pragma once + +#include + +namespace faker +{ +class Medicine +{ + +public: + /** + * @brief Returns a random medical condition. + * + * @returns Medical condition. + * + * @code + * Medicine::condition() // "AIDS" + * @endcode + * + */ + static std::string condition(); + + /** + * @brief Returns a random medical test + * + * @returns Medical test. + * + * @code + * Medicine::medicalTest() // "pulmonary auscultation" + * @endcode + * + */ + static std::string medicalTest(); + + /** + * @brief Returns a random Medical specialty + * + * @returns Medical specialty. + * @code + * Medicine::specialty() // "Cardiology" + * @endcode + * + */ + + static std::string specialty(); +}; +} diff --git a/src/modules/medicine/Medicine.cpp b/src/modules/medicine/Medicine.cpp new file mode 100644 index 000000000..b88081f2e --- /dev/null +++ b/src/modules/medicine/Medicine.cpp @@ -0,0 +1,24 @@ +#include "faker-cxx/Medicine.h" + +#include "data/conditon.h" +#include "data/medicaltests.h" +#include "data/specialty.h" +#include "faker-cxx/Helper.h" + +namespace faker +{ +std::string Medicine::condition() +{ + return Helper::arrayElement(medicalConditions); +} + +std::string Medicine::medicalTest() +{ + return Helper::arrayElement(medicalTests); +} +std::string Medicine::specialty() +{ + return Helper::arrayElement(specialties); +} + +} diff --git a/src/modules/medicine/MedicineTest.cpp b/src/modules/medicine/MedicineTest.cpp new file mode 100644 index 000000000..02c312c43 --- /dev/null +++ b/src/modules/medicine/MedicineTest.cpp @@ -0,0 +1,40 @@ + +#include +#include +#include + +#include "data/conditon.h" +#include "data/medicaltests.h" +#include "data/specialty.h" + +using namespace ::testing; +using namespace faker; + +class MedicineTest : public Test +{ +public: +}; + +TEST_F(MedicineTest, shouldGenerateMedicalCondition) +{ + const auto generatedMedicalCondition = Medicine::condition(); + + ASSERT_TRUE(std::ranges::any_of(medicalConditions, [generatedMedicalCondition](const std::string& medicalCondition) + { return medicalCondition == generatedMedicalCondition; })); +} + +TEST_F(MedicineTest, shouldGenerateMedicalTest) +{ + const auto generatedMedicalTest = Medicine::medicalTest(); + + ASSERT_TRUE(std::ranges::any_of(medicalTests, [generatedMedicalTest](const std::string& medicalTest) + { return medicalTest == generatedMedicalTest; })); +} + +TEST_F(MedicineTest, shouldGenerateSpecialty) +{ + const auto generatedSpecialty = Medicine::specialty(); + + ASSERT_TRUE(std::ranges::any_of(specialties, [generatedSpecialty](const std::string& specialty) + { return specialty == generatedSpecialty; })); +} diff --git a/src/modules/medicine/data/conditon.h b/src/modules/medicine/data/conditon.h new file mode 100644 index 000000000..2d08e4b0a --- /dev/null +++ b/src/modules/medicine/data/conditon.h @@ -0,0 +1,69 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector medicalConditions = { + "AIDS", + "Anorexia Nervosa", + "Arthritis, Juvenile Rheumatoid", + "Asthma, Moderate or Severe Persistent", + "Bronchiolitis", + "Bulimia", + "Cancer", + "Cardiorespiratory Diseases", + "Celiac Disease", + "Cerebral Palsy", + "Cleft Lip or Palate", + "Crohn’s Disease", + "Cystic Fibrosis", + "Depression", + "Developmental, Sensory, or Motor Disabilities", + "Diabetes Mellitus", + "Down syndrome", + "Elevated Blood Lead Level", + "Epilepsy", + "Failure to Thrive", + "Fetal Alcohol Syndrome", + "Gall Bladder Disease", + "Gastro Esophageal Reflux Disease", + "Gastrointestinal Abnormalities", + "HIV Infection", + "Heart Disease", + "Hepatitis", + "Hypertension, Chronic/Prehypertension", + "Hypertension, Pregnancy-induced", + "Hyperthyroidism", + "Hypoglycemia", + "Hypothyroidism", + "Inborn Errors of Metabolism", + "Inflammatory Bowel Disease (IBD)", + "Lactose Intolerance", + "Large for Gestational Age", + "Liver Disease", + "Lupus Erythematosus", + "Major Surgery, Burns, or Trauma", + "Malabsorption Syndromes", + "Meningitis", + "Multiple Sclerosis", + "Muscular Dystrophy", + "Neonatal Abstinence Syndrome", + "Neural Tube Defect (Spina Bifida)", + "Nutrient Deficiency Diseases", + "Pancreatitis", + "Parasitic Infection", + "Parkinson’s disease", + "Pneumonia", + "Prediabetes", + "Renal Disease", + "Sickle Cell Anemia", + "Small Bowel Enterocolitis and syndrome", + "Small for Gestational Age (SGA)", + "Thalassemia Major", + "Tuberculosis", + "Ulcerative Colitis", + "Ulcers, Stomach or Intestinal", +}; +} diff --git a/src/modules/medicine/data/medicaltests.h b/src/modules/medicine/data/medicaltests.h new file mode 100644 index 000000000..8d7ff8cac --- /dev/null +++ b/src/modules/medicine/data/medicaltests.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector medicalTests = { + "abdominal palpation", + "cardiac auscultation", + "HEENT examination", + "digital rectal examination", + "neurological examination", + "psychiatric assessment", + "pulmonary auscultation", + "vaginal examination", + "coronary catheterization", + "echocardiography", + "electrocardiogram", + "ballistocardiogram", + "skin biopsy", + "hearing test", + "laryngoscopy", + "capsule endoscopy", + "coloscopy", + "endoscopic retrograde cholangiopancreatography", + "esophagogastroduodenoscopy", + "esophageal motility study", + "esophageal pH monitoring", + "liver biopsy", + "electroencephalogram", + "electromyography", + "neuropsychological tests", + "amniocentesis", + "colposcopy", + "mammography", + "hysteroscopy", + "laparoscopy", + "polysomnography", + "pulmonary plethysmography", + "thoracentesis", + "cystoscopy", + "urodynamic testing", +}; +} diff --git a/src/modules/medicine/data/specialty.h b/src/modules/medicine/data/specialty.h new file mode 100644 index 000000000..3bb0b04a2 --- /dev/null +++ b/src/modules/medicine/data/specialty.h @@ -0,0 +1,65 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector specialties = { + "Accident and emergency medicine", + "Allergist", + "Anaesthetics", + "Cardiology", + "Child psychiatry", + "Clinical biology", + "Clinical chemistry", + "Clinical microbiology", + "Clinical neurophysiology", + "Craniofacial surgery", + "Dermatology", + "Endocrinology", + "Family and General Medicine", + "Gastroenterologic surgery", + "Gastroenterology", + "General Practice", + "General surgery", + "Geriatrics", + "Hematology", + "Immunology", + "Infectious diseases", + "Internal medicine", + "Laboratory medicine", + "Nephrology", + "Neuropsychiatry", + "Neurology", + "Neurosurgery", + "Nuclear medicine", + "Obstetrics and gynaecology", + "Occupational medicine", + "Oncology", + "Ophthalmology", + "Oral and maxillofacial surgery", + "Orthopaedics", + "Otorhinolaryngology", + "Paediatric surgery", + "Paediatrics", + "Pathology", + "Pharmacology", + "Physical medicine and rehabilitation", + "Plastic surgery", + "Podiatric surgery", + "Preventive medicine", + "Psychiatry", + "Public health", + "Radiation Oncology", + "Radiology", + "Respiratory medicine", + "Rheumatology", + "Stomatology", + "Thoracic surgery", + "Tropical medicine", + "Urology", + "Vascular surgery", + "Venereology", +}; +}