diff --git a/include/faker-cxx/Plant.h b/include/faker-cxx/Plant.h index be763340..d0517b62 100644 --- a/include/faker-cxx/Plant.h +++ b/include/faker-cxx/Plant.h @@ -2,97 +2,93 @@ #include -namespace faker +namespace faker::plant { -class Plant -{ -public: - /** - * @brief Returns a random species of tree. - * - * @returns Species of tree. - * - * @code - * Plant::tree() // "Oak" - * @endcode - */ - static std::string_view tree(); +/** + * @brief Returns a random species of tree. + * + * @returns Species of tree. + * + * @code + * Plant::tree() // "Oak" + * @endcode + */ +std::string_view tree(); - /** - * @brief Returns a random species of flower. - * - * @returns Species of flower. - * - * @code - * Plant::flower() // "Rose" - * @endcode - */ - static std::string_view flower(); +/** + * @brief Returns a random species of flower. + * + * @returns Species of flower. + * + * @code + * Plant::flower() // "Rose" + * @endcode + */ +std::string_view flower(); - /** - * @brief Returns a random species of shrub. - * - * @returns Species of shrub. - * - * @code - * Plant::shrub() // "Azalea" - * @endcode - */ - static std::string_view shrub(); +/** + * @brief Returns a random species of shrub. + * + * @returns Species of shrub. + * + * @code + * Plant::shrub() // "Azalea" + * @endcode + */ +std::string_view shrub(); - /** - * @brief Returns a random species of grass. - * - * @returns Species of grass. - * - * @code - * Plant::grass() // "Kentucky Bluegrass" - * @endcode - */ - static std::string_view grass(); +/** + * @brief Returns a random species of grass. + * + * @returns Species of grass. + * + * @code + * Plant::grass() // "Kentucky Bluegrass" + * @endcode + */ +std::string_view grass(); - /** - * @brief Returns a random species of fern. - * - * @returns Species of fern. - * - * @code - * Plant::fern() // "Maidenhair" - * @endcode - */ - static std::string_view fern(); +/** + * @brief Returns a random species of fern. + * + * @returns Species of fern. + * + * @code + * Plant::fern() // "Maidenhair" + * @endcode + */ +std::string_view fern(); - /** - * @brief Returns a random species of succulent. - * - * @returns Species of succulent. - * - * @code - * Plant::succulent() // "Aloe Vera" - * @endcode - */ - static std::string_view succulent(); +/** + * @brief Returns a random species of succulent. + * + * @returns Species of succulent. + * + * @code + * Plant::succulent() // "Aloe Vera" + * @endcode + */ +std::string_view succulent(); - /** - * @brief Returns a random species of vine. - * - * @returns Species of vine. - * - * @code - * Plant::vine() // "Ivy" - * @endcode - */ - static std::string_view vine(); +/** + * @brief Returns a random species of vine. + * + * @returns Species of vine. + * + * @code + * Plant::vine() // "Ivy" + * @endcode + */ +std::string_view vine(); - /** - * @brief Returns a random type of plant. - * - * @returns Type of plant. - * - * @code - * Plant::type() // "tree" - * @endcode - */ - static std::string_view plantType(); -}; +/** + * @brief Returns a random type of plant. + * + * @returns Type of plant. + * + * @code + * Plant::type() // "tree" + * @endcode + */ +std::string_view plantType(); } diff --git a/src/modules/plant/Plant.cpp b/src/modules/plant/Plant.cpp index 4a2479e3..d87b8ee3 100644 --- a/src/modules/plant/Plant.cpp +++ b/src/modules/plant/Plant.cpp @@ -5,44 +5,44 @@ #include "faker-cxx/Helper.h" #include "PlantData.h" -namespace faker +namespace faker::plant { -std::string_view Plant::tree() +std::string_view tree() { return Helper::arrayElement(trees); } -std::string_view Plant::flower() +std::string_view flower() { return Helper::arrayElement(flowers); } -std::string_view Plant::shrub() +std::string_view shrub() { return Helper::arrayElement(shrubs); } -std::string_view Plant::grass() +std::string_view grass() { return Helper::arrayElement(grasses); } -std::string_view Plant::fern() +std::string_view fern() { return Helper::arrayElement(ferns); } -std::string_view Plant::succulent() +std::string_view succulent() { return Helper::arrayElement(succulents); } -std::string_view Plant::vine() +std::string_view vine() { return Helper::arrayElement(vines); } -std::string_view Plant::plantType() +std::string_view plantType() { return Helper::arrayElement(plantTypes); } diff --git a/src/modules/plant/PlantData.h b/src/modules/plant/PlantData.h index 340c54e1..21cf1cf4 100644 --- a/src/modules/plant/PlantData.h +++ b/src/modules/plant/PlantData.h @@ -3,7 +3,7 @@ #include #include -namespace faker +namespace faker::plant { const auto trees = std::to_array({ "Oak", "Maple", "Pine", "Birch", "Willow", "Cherry Blossom", @@ -112,77 +112,76 @@ const auto flowers = std::to_array({ }); const auto shrubs = std::to_array({ - "Abelia", "Actinidia", "Aloe", - "Aralia", "Arctostaphylos", "Aronia", - "Artemisia", "Aucuba", "Berberis", - "Bougainvillea", "Brugmansia", "Buddleja", - "Buxus", "Calia", "Callicarpa", - "Callistemon", "Calluna", "Calycanthus", - "Camellia", "Caragana", "Carpenteria", - "Caryopteris", "Cassiope", "Ceanothus", - "Celastrus", "Ceratostigma", "Cercocarpus", - "Chaenomeles", "Chamaebatiaria", "Chamaedaphne", - "Chimonanthus", "Chionanthus", "Choisya", - "Cistus", "Clerodendrum", "Clethra", - "Clianthus", "Colletia", "Colutea", - "Comptonia", "Cornus", "Corylopsis", - "Cotinus", "Cotoneaster", "Cowania", - "Crataegus", "Crinodendron", "Cytisus", - "Daboecia", "Danae", "Daphne", - "Decaisnea", "Dasiphora", "Dendromecon", - "Desfontainea", "Deutzia", "Diervilla", - "Dipelta", "Dirca", "Dracaena", - "Drimys", "Dryas", "Elaeagnus", - "Embothrium", "Empetrum", "Enkianthus", - "Ephedra", "Epigaea", "Erica", - "Eriobotrya", "Escallonia", "Eucryphia", - "Euonymus", "Exochorda", "Fabiana", - "Fallugia", "Fatsia", "Forsythia", - "Fothergilla", "Franklinia", "Fremontodendron", - "Fuchsia", "Garrya", "Gaultheria", - "Gaylussacia", "Genista", "Gordonia", - "Grevillea", "Griselinia", "Hakea", - "Halesia", "Halimium", "Hamamelis", - "Hebe", "Hedera", "Helianthemum", - "Hibiscus", "Hippophae", "Hoheria", - "Holodiscus", "Hudsonia", "Hydrangea", - "Hypericum", "Hyssopus", "Ilex", - "Illicium", "Indigofera", "Itea", - "Jamesia", "Jasminum", "Juniperus", - "Kalmia", "Kerria", "Kolkwitzia", - "Lagerstroemia", "Lapageria", "Lantana", - "Lavandula", "Lavatera", "Ledum", - "Leitneria", "Lespedeza", "Leptospermum", - "Leucothoe", "Leycesteria", "Ligustrum", - "Lindera", "Linnaea", "Lonicera", - "Lupinus", "Lycium", "Magnolia", - "Mahonia", "Malpighia", "Menispermum", - "Menziesia", "Mespilus", "Microcachrys", - "Myrica", "Myricaria", "Myrtus", - "Neillia", "Nerium", "Olearia", - "Osmanthus", "Pachysandra", "Paeonia", - "Perovskia", "Philadelphus", "Phlomis", - "Photinia", "Physocarpus", "Pieris", - "Pistacia", "Pittosporum", "Plumbago", - "Polygala", "Poncirus", "Prunus", - "Purshia", "Pyracantha", "Quassia", - "Quercus", "Quillaja", "Quintinia", - "Rhamnus", "Rhododendron", "Rhus", - "Ribes", "Romneya", "Rosa", - "Rosmarinus", "Rubus", "Ruta", - "Sabia", "Salix", "Salvia", - "Sambucus", "Santolina", "Sapindus", - "Senecio", "Simmondsia", "Skimmia", - "Smilax", "Sophora", "Sorbaria", - "Spartium", "Spiraea", "Staphylea", - "Stephanandra", "Styrax", "Symphoricarpos", - "Syringa", "Tamarix", "Taxus", - "Telopea", "Thymelaea", "Thymus", - "Trochodendron", "Ulex", "Ungnadia", - "Vaccinium", "Verbena", "Viburnum", - "Vinca", "Viscum", "Weigela", - "Xanthoceras", "Xanthorhiza", "Xylosma", - "Yucca", "Zanthoxylum", "Zauschneria", + "Aralia", "Arctostaphylos", "Aronia", + "Artemisia", "Aucuba", "Berberis", + "Bougainvillea", "Brugmansia", "Buddleja", + "Buxus", "Calia", "Callicarpa", + "Callistemon", "Calluna", "Calycanthus", + "Camellia", "Caragana", "Carpenteria", + "Caryopteris", "Cassiope", "Ceanothus", + "Celastrus", "Ceratostigma", "Cercocarpus", + "Chaenomeles", "Chamaebatiaria", "Chamaedaphne", + "Chimonanthus", "Chionanthus", "Choisya", + "Cistus", "Clerodendrum", "Clethra", + "Clianthus", "Colletia", "Colutea", + "Comptonia", "Cornus", "Corylopsis", + "Cotinus", "Cotoneaster", "Cowania", + "Crataegus", "Crinodendron", "Cytisus", + "Daboecia", "Danae", "Daphne", + "Decaisnea", "Dasiphora", "Dendromecon", + "Desfontainea", "Deutzia", "Diervilla", + "Dipelta", "Dirca", "Dracaena", + "Drimys", "Dryas", "Elaeagnus", + "Embothrium", "Empetrum", "Enkianthus", + "Ephedra", "Epigaea", "Erica", + "Eriobotrya", "Escallonia", "Eucryphia", + "Euonymus", "Exochorda", "Fabiana", + "Fallugia", "Fatsia", "Forsythia", + "Fothergilla", "Franklinia", "Fremontodendron", + "Fuchsia", "Garrya", "Gaultheria", + "Gaylussacia", "Genista", "Gordonia", + "Grevillea", "Griselinia", "Hakea", + "Halesia", "Halimium", "Hamamelis", + "Hebe", "Hedera", "Helianthemum", + "Hibiscus", "Hippophae", "Hoheria", + "Holodiscus", "Hudsonia", "Hydrangea", + "Hypericum", "Hyssopus", "Ilex", + "Illicium", "Indigofera", "Itea", + "Jamesia", "Jasminum", "Juniperus", + "Kalmia", "Kerria", "Kolkwitzia", + "Lagerstroemia", "Lapageria", "Lantana", + "Lavandula", "Lavatera", "Ledum", + "Leitneria", "Lespedeza", "Leptospermum", + "Leucothoe", "Leycesteria", "Ligustrum", + "Lindera", "Linnaea", "Lonicera", + "Lupinus", "Lycium", "Magnolia", + "Mahonia", "Malpighia", "Menispermum", + "Menziesia", "Mespilus", "Microcachrys", + "Myrica", "Myricaria", "Myrtus", + "Neillia", "Nerium", "Olearia", + "Osmanthus", "Pachysandra", "Paeonia", + "Perovskia", "Philadelphus", "Phlomis", + "Photinia", "Physocarpus", "Pieris", + "Pistacia", "Pittosporum", "Plumbago", + "Polygala", "Poncirus", "Prunus", + "Purshia", "Pyracantha", "Quassia", + "Quercus", "Quillaja", "Quintinia", + "Rhamnus", "Rhododendron", "Rhus", + "Ribes", "Romneya", "Rosa", + "Rosmarinus", "Rubus", "Ruta", + "Sabia", "Salix", "Salvia", + "Sambucus", "Santolina", "Sapindus", + "Senecio", "Simmondsia", "Skimmia", + "Smilax", "Sophora", "Sorbaria", + "Spartium", "Spiraea", "Staphylea", + "Stephanandra", "Styrax", "Symphoricarpos", + "Syringa", "Tamarix", "Taxus", + "Telopea", "Thymelaea", "Thymus", + "Trochodendron", "Ulex", "Ungnadia", + "Vaccinium", "Verbena", "Viburnum", + "Vinca", "Viscum", "Weigela", + "Xanthoceras", "Xanthorhiza", "Xylosma", + "Yucca", "Zanthoxylum", "Zauschneria", "Zenobia", "Ziziphus" }); diff --git a/tests/modules/plant/PlantTest.cpp b/tests/modules/plant/PlantTest.cpp index b028c7c4..96a490ab 100644 --- a/tests/modules/plant/PlantTest.cpp +++ b/tests/modules/plant/PlantTest.cpp @@ -8,7 +8,7 @@ #include "plant/PlantData.h" using namespace ::testing; -using namespace faker; +using namespace faker::plant; class PlantTest : public Test { @@ -17,7 +17,7 @@ class PlantTest : public Test TEST_F(PlantTest, shouldGenerateTree) { - const auto generatedTree = Plant::tree(); + const auto generatedTree = tree(); ASSERT_TRUE( std::ranges::any_of(trees, [generatedTree](const std::string_view& tree) { return tree == generatedTree; })); @@ -25,7 +25,7 @@ TEST_F(PlantTest, shouldGenerateTree) TEST_F(PlantTest, shouldGenerateFlower) { - const auto generatedFlower = Plant::flower(); + const auto generatedFlower = flower(); ASSERT_TRUE(std::ranges::any_of(flowers, [generatedFlower](const std::string_view& flower) { return flower == generatedFlower; })); @@ -33,7 +33,7 @@ TEST_F(PlantTest, shouldGenerateFlower) TEST_F(PlantTest, shouldGenerateShrub) { - const auto generatedShrub = Plant::shrub(); + const auto generatedShrub = shrub(); ASSERT_TRUE(std::ranges::any_of(shrubs, [generatedShrub](const std::string_view& shrub) { return shrub == generatedShrub; })); @@ -41,7 +41,7 @@ TEST_F(PlantTest, shouldGenerateShrub) TEST_F(PlantTest, shouldGenerateGrass) { - const auto generatedGrass = Plant::grass(); + const auto generatedGrass = grass(); ASSERT_TRUE(std::ranges::any_of(grasses, [generatedGrass](const std::string_view& grass) { return grass == generatedGrass; })); @@ -49,7 +49,7 @@ TEST_F(PlantTest, shouldGenerateGrass) TEST_F(PlantTest, shouldGenerateFern) { - const auto generatedFern = Plant::fern(); + const auto generatedFern = fern(); ASSERT_TRUE( std::ranges::any_of(ferns, [generatedFern](const std::string_view& fern) { return fern == generatedFern; })); @@ -57,7 +57,7 @@ TEST_F(PlantTest, shouldGenerateFern) TEST_F(PlantTest, shouldGenerateSucculent) { - const auto generatedSucculent = Plant::succulent(); + const auto generatedSucculent = succulent(); ASSERT_TRUE(std::ranges::any_of(succulents, [generatedSucculent](const std::string_view& succulent) { return succulent == generatedSucculent; })); @@ -65,7 +65,7 @@ TEST_F(PlantTest, shouldGenerateSucculent) TEST_F(PlantTest, shouldGenerateVine) { - const auto generatedVine = Plant::vine(); + const auto generatedVine = vine(); ASSERT_TRUE( std::ranges::any_of(vines, [generatedVine](const std::string_view& vine) { return vine == generatedVine; })); @@ -73,7 +73,7 @@ TEST_F(PlantTest, shouldGenerateVine) TEST_F(PlantTest, shouldGenerateType) { - const auto generatedType = Plant::plantType(); + const auto generatedType = plantType(); ASSERT_TRUE(std::ranges::any_of(plantTypes, [generatedType](const std::string_view& plantType) { return plantType == generatedType; }));