From 73a273e3dae9094009346937c4ee678741ac80d7 Mon Sep 17 00:00:00 2001 From: Michal Cieslar Date: Thu, 30 May 2024 11:30:16 +0200 Subject: [PATCH] refactor food module data --- CMakeLists.txt | 1 + include/faker-cxx/Food.h | 30 +- src/modules/food/Food.cpp | 71 ++--- src/modules/food/FoodData.cpp | 271 ++++++++++++++++++ src/modules/food/FoodData.h | 22 ++ src/modules/food/data/AlcoholicBeverages.h | 57 ---- src/modules/food/data/DishNames.h | 95 ------ src/modules/food/data/FoodCategories.h | 12 - src/modules/food/data/Fruits.h | 16 -- src/modules/food/data/Grains.h | 14 - src/modules/food/data/Meats.h | 12 - src/modules/food/data/MilkProducts.h | 15 - src/modules/food/data/NonalcoholicBeverages.h | 41 --- src/modules/food/data/Nuts.h | 12 - src/modules/food/data/Oils.h | 13 - src/modules/food/data/Seafoods.h | 13 - src/modules/food/data/Seeds.h | 16 -- src/modules/food/data/SugarProducts.h | 34 --- src/modules/food/data/Vegetables.h | 15 - tests/modules/food/FoodTest.cpp | 49 ++-- 20 files changed, 357 insertions(+), 452 deletions(-) create mode 100644 src/modules/food/FoodData.cpp create mode 100644 src/modules/food/FoodData.h delete mode 100644 src/modules/food/data/AlcoholicBeverages.h delete mode 100644 src/modules/food/data/DishNames.h delete mode 100644 src/modules/food/data/FoodCategories.h delete mode 100644 src/modules/food/data/Fruits.h delete mode 100644 src/modules/food/data/Grains.h delete mode 100644 src/modules/food/data/Meats.h delete mode 100644 src/modules/food/data/MilkProducts.h delete mode 100644 src/modules/food/data/NonalcoholicBeverages.h delete mode 100644 src/modules/food/data/Nuts.h delete mode 100644 src/modules/food/data/Oils.h delete mode 100644 src/modules/food/data/Seafoods.h delete mode 100644 src/modules/food/data/Seeds.h delete mode 100644 src/modules/food/data/SugarProducts.h delete mode 100644 src/modules/food/data/Vegetables.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bf4ca992..4a70f2556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ set(FAKER_SOURCES src/modules/finance/Finance.cpp src/modules/finance/FinanceData.cpp src/modules/food/Food.cpp + src/modules/food/FoodData.cpp src/modules/git/Git.cpp src/modules/hacker/Hacker.cpp src/modules/helper/Helper.cpp diff --git a/include/faker-cxx/Food.h b/include/faker-cxx/Food.h index 3920da26e..c2a6577b1 100644 --- a/include/faker-cxx/Food.h +++ b/include/faker-cxx/Food.h @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace faker { @@ -16,7 +16,7 @@ class Food * Food::alcoholicBeverage() // "champain" * @endcode */ - static std::string alcoholicBeverage(); + static std::string_view alcoholicBeverage(); /** * @brief Returns a random grain measurement. @@ -27,7 +27,7 @@ class Food * Food::grain() // "1 Lt" * @endcode */ - static std::string grain(); + static std::string_view grain(); /** * @brief Returns a random milk product's name. @@ -38,7 +38,7 @@ class Food * Food::milkProduct() // "mozzarella" * @endcode */ - static std::string milkProduct(); + static std::string_view milkProduct(); /** * @brief Returns a random fruit's name. @@ -49,7 +49,7 @@ class Food * Food::fruit() // "apple" * @endcode */ - static std::string fruit(); + static std::string_view fruit(); /** * @brief Returns a random meat's name. @@ -60,7 +60,7 @@ class Food * Food::meat() // "antrikot" * @endcode */ - static std::string meat(); + static std::string_view meat(); /** * @brief Returns a random seafood's name. @@ -71,7 +71,7 @@ class Food * Food::seafood() // "lobster" * @endcode */ - static std::string seafood(); + static std::string_view seafood(); /** * @brief Returns a random vegetable's name. @@ -82,7 +82,7 @@ class Food * Food::vegetable() // "watermelon" * @endcode */ - static std::string vegetable(); + static std::string_view vegetable(); /** * @brief Returns a random oil's name. @@ -93,7 +93,7 @@ class Food * Food::oil() // "olive oil" * @endcode */ - static std::string oil(); + static std::string_view oil(); /** * @brief Returns a random nut's name. @@ -104,7 +104,7 @@ class Food * Food::nut() // "walnut" * @endcode */ - static std::string nut(); + static std::string_view nut(); /** * @brief Returns a random seed's name. @@ -115,7 +115,7 @@ class Food * Food::seed() // "mozzarella" * @endcode */ - static std::string seed(); + static std::string_view seed(); /** * @brief Returns a random sugar product's name. @@ -126,7 +126,7 @@ class Food * Food::sugarProduct() // "honey harmony" * @endcode */ - static std::string sugarProduct(); + static std::string_view sugarProduct(); /** * @brief Returns a random non-alcoholic beverage's name. @@ -137,7 +137,7 @@ class Food * Food::nonalcoholicBeverage() // "water" * @endcode */ - static std::string nonalcoholicBeverage(); + static std::string_view nonalcoholicBeverage(); /** * @brief Returns a random dish's name. @@ -148,7 +148,7 @@ class Food * Food::dishName() // "beef wellington" * @endcode */ - static std::string dishName(); + static std::string_view dishName(); /** * @brief Returns a random food categories' name. @@ -159,6 +159,6 @@ class Food * Food::foodCategory() // "Dairy" * @endcode */ - static std::string foodCategory(); + static std::string_view foodCategory(); }; } diff --git a/src/modules/food/Food.cpp b/src/modules/food/Food.cpp index b9e66ec17..7bc544ccd 100644 --- a/src/modules/food/Food.cpp +++ b/src/modules/food/Food.cpp @@ -1,90 +1,77 @@ #include "faker-cxx/Food.h" -#include "data/AlcoholicBeverages.h" -#include "data/DishNames.h" -#include "data/FoodCategories.h" -#include "data/Fruits.h" -#include "data/Grains.h" -#include "data/Meats.h" -#include "data/MilkProducts.h" -#include "data/NonalcoholicBeverages.h" -#include "data/Nuts.h" -#include "data/Oils.h" -#include "data/Seafoods.h" -#include "data/Seeds.h" -#include "data/SugarProducts.h" -#include "data/Vegetables.h" #include "faker-cxx/Helper.h" +#include "FoodData.h" namespace faker { -std::string Food::alcoholicBeverage() +std::string_view Food::alcoholicBeverage() { - return Helper::arrayElement(alcoholicBeverages); + return Helper::arrayElement(alcoholicBeverages); } -std::string Food::dishName() +std::string_view Food::dishName() { - return Helper::arrayElement(dishNames); + return Helper::arrayElement(dishNames); } -std::string Food::foodCategory() +std::string_view Food::foodCategory() { - return Helper::arrayElement(foodCategories); + return Helper::arrayElement(foodCategories); } -std::string Food::fruit() +std::string_view Food::fruit() { - return Helper::arrayElement(fruits); + return Helper::arrayElement(fruits); } -std::string Food::grain() +std::string_view Food::grain() { - return Helper::arrayElement(grains); + return Helper::arrayElement(grains); } -std::string Food::meat() +std::string_view Food::meat() { - return Helper::arrayElement(meats); + return Helper::arrayElement(meats); } -std::string Food::milkProduct() +std::string_view Food::milkProduct() { - return Helper::arrayElement(milkProducts); + return Helper::arrayElement(milkProducts); } -std::string Food::nonalcoholicBeverage() +std::string_view Food::nonalcoholicBeverage() { - return Helper::arrayElement(nonalcoholicBeverages); + return Helper::arrayElement(nonalcoholicBeverages); } -std::string Food::nut() +std::string_view Food::nut() { - return Helper::arrayElement(nuts); + return Helper::arrayElement(nuts); } -std::string Food::oil() +std::string_view Food::oil() { - return Helper::arrayElement(oils); + return Helper::arrayElement(oils); } -std::string Food::seafood() +std::string_view Food::seafood() { - return Helper::arrayElement(seafoods); + return Helper::arrayElement(seafoods); } -std::string Food::seed() +std::string_view Food::seed() { - return Helper::arrayElement(seeds); + return Helper::arrayElement(seeds); } -std::string Food::sugarProduct() +std::string_view Food::sugarProduct() { - return Helper::arrayElement(sugarProducts); + return Helper::arrayElement(sugarProducts); } -std::string Food::vegetable() +std::string_view Food::vegetable() { - return Helper::arrayElement(vegetables); + return Helper::arrayElement(vegetables); } } diff --git a/src/modules/food/FoodData.cpp b/src/modules/food/FoodData.cpp new file mode 100644 index 000000000..6a12c4c67 --- /dev/null +++ b/src/modules/food/FoodData.cpp @@ -0,0 +1,271 @@ +#include "FoodData.h" + +namespace faker +{ +const std::array alcoholicBeverages{ + "Beer", + "Wine", + "Vodka", + "Rum", + "Gin", + "Whiskey", + "Tequila", + "Brandy", + "Champagne", + "Cider", + "Sake", + "Absinthe", + "Cognac", + "Schnapps", + "Mead", + "Bourbon", + "Scotch", + "Irish Cream", + "Jägermeister", + "Pisco", + "Port Wine", + "Sherry", + "Grappa", + "Sambuca", + "Midori", + "Kahlúa", + "Baileys Irish Cream", + "Pina Colada", + "Margarita", + "Cosmopolitan", + "Mai Tai", + "Negroni", + "Martini", + "Old Fashioned", + "Mojito", + "Caipirinha", + "Piña Colada", + "Bloody Mary", + "Tom Collins", + "Singapore Sling", + "Manhattan", + "Moscow Mule", + "Paloma", + "Bellini", + "Mimosa", + "White Russian", + "Black Russian", +}; + +const std::array dishNames = { + "Sushi", + "Paella", + "Biryani", + "Poutine", + "Kebab", + "Kimchi", + "Rendang", + "Pad Krapow Moo Saap", + "Goulash", + "Pho", + "Tacos", + "Pierogi", + "Tagine", + "Moussaka", + "Feijoada", + "Dim Sum", + "Ceviche", + "Jollof Rice", + "Pierogi", + "Borscht", + "Pavlova", + "Katsudon", + "Chimichurri", + "Laksa", + "Tandoori Chicken", + "Haggis", + "Baklava", + "Caponata", + "Tom Kha Gai", + "Ramen", + "Arroz con Pollo", + "Baklava", + "Dolma", + "Samosa", + "Bánh Mì", + "Lobster Thermidor", + "Perogies", + "Arepas", + "Nasi Goreng", + "Pav Bhaji", + "Causa Rellena", + "Baba Ganoush", + "Chicken Piccata", + "Penne alla Vodka", + "Beef and Broccoli", + "Shrimp Fried Rice", + "Butter Chicken", + "Egg Fried Rice", + "Stuffed Bell Peppers", + "Chicken Tikka Masala", + "Lemon Herb Roast Chicken", + "Shrimp Scampi Pasta", + "Beef Bulgogi", + "Tom Yum Soup", + "Chicken Katsu", + "Vegetable Curry", + "Chicken Quesadilla", + "Pho", + "Honey Garlic Glazed Salmon", + "Eggplant Rollatini", + "Lemon Butter Shrimp", + "Chicken Teriyaki", + "Mango Salsa Chicken", + "Cauliflower Fried Rice", + "Chicken Fajitas", + "Sausage and Mushroom Risotto", + "Tomato Basil Mozzarella Skewers", + "Garlic Parmesan Roasted Brussels Sprouts", + "Beef Chimichanga", + "Pulled Pork Sandwich", + "Tandoori Chicken", + "Mongolian Beef", + "Vegetarian Paella", + "Chicken Enchiladas", + "Lemon Herb Grilled Fish", + "Spinach and Feta Stuffed Chicken Breast", + "Cajun Shrimp Pasta", + "Teriyaki Salmon", + "Baked Ziti", + "Chicken Alfredo Pizza", + "Caprese Stuffed Avocado", + "Lobster Roll", + "Chicken Caesar Salad", + "Beef and Mushroom Pie", + "Garlic Herb Roasted Potatoes", +}; + +const std::array foodCategories = { + "Vegetables", "Fruits", "Meat", "Seafood", "Dairy", "Grains", + "Beverages", "Desserts", "Snacks", "Condiments", "Frozen Foods", +}; + +const std::array fruits = { + "Apple", "Banana", "Orange", "Strawberry", "Pineapple", "Mango", "Grapes", + "Kiwi", "Peach", "Pear", "Cherry", "Blueberry", "Raspberry", "Blackberry", + "Avocado", "Lemon", "Lime", "Grapefruit", "Cantaloupe", "Honeydew", "Pomegranate", + "Apricot", "Plum", "Nectarine", "Fig", "Papaya", "Passion Fruit", "Guava", + "Coconut", "Dragon Fruit", "Persimmon", "Cranberry", "Date", "Lychee", "Mulberry", + "Kumquat", "Jackfruit", "Starfruit", "Rambutan", "Gooseberry", "Elderberry", +}; + +const std::array grains = { + "Wheat", "Rice", "Barley", "Oats", "Quinoa", "Corn", "Rye", + "Millet", "Buckwheat", "Sorghum", "Amaranth", "Triticale", "Spelt", "Farro", + "Kamut", "Emmer", "Freekeh", "Teff", "Job's Tears", "Einkorn", "Bulgur", + "Maize", "Semolina", "Soy", "Lentils", "Chia Seeds", "Flaxseeds", "Sunflower Seeds", +}; + +const std::array meats = { + "Chicken", "Beef", "Pork", "Lamb", "Turkey", "Fish", "Venison", "Duck", "Quail", "Goose", "Salmon", + "Shrimp", "Crab", "Lobster", "Bison", "Veal", "Haddock", "Trout", "Tuna", "Sausage", "Ham", +}; + +const std::array milkProducts = { + "Milk", "Cheese", "Yogurt", "Butter", "Cream", "Sour Cream", "Cottage Cheese", + "Whipped Cream", "Ice Cream", "Condensed Milk", "Evaporated Milk", "Mozzarella", "Feta", "Parmesan", + "Provolone", "Cheddar", "Gouda", "Blue Cheese", "Swiss Cheese", "Brie", "Camembert", + "Ricotta", "Goat Cheese", "Mascarpone", "Quark", "Havarti", "Colby", "Monterey Jack", + "Gruyère", "Havarti", "Cream Cheese", "Neufchâtel", +}; + +const std::array nonalcoholicBeverages = { + "Water", + "Tea", + "Coffee", + "Milk", + "Orange Juice", + "Apple Juice", + "Lemonade", + "Iced Tea", + "Cranberry Juice", + "Grape Juice", + "Pineapple Juice", + "Coconut Water", + "Tomato Juice", + "Ginger Ale", + "Hot Chocolate", + "Limeade", + "Grapefruit Juice", + "Club Soda", + "Root Beer", + "Fruit Punch", + "Pomegranate Juice", + "Chai Tea", + "Almond Milk", + "Soy Milk", + "Raspberry Lemonade", + "Peach Iced Tea", + "Hibiscus Tea", + "Green Smoothie", + "Vegetable Juice", + "Pear Nectar", + "Mango Lassi", +}; + +const std::array nuts = { + "Almond", "Walnut", "Pecan", "Cashew", "Pistachio", "Hazelnut", + "Macadamia", "Brazil Nut", "Pine Nut", "Chestnut", "Peanut", +}; + +const std::array oils = { + "Olive Oil", "Coconut Oil", "Vegetable Oil", "Canola Oil", "Sesame Oil", "Sunflower Oil", "Peanut Oil", + "Grapeseed Oil", "Avocado Oil", "Corn Oil", "Flaxseed Oil", "Walnut Oil", "Safflower Oil", "Hazelnut Oil", + "Almond Oil", "Palm Oil", "Mustard Oil", "Chia Seed Oil", "Hemp Oil", "Pumpkin Seed Oil", +}; + +const std::array seafoods = { + "Salmon", "Shrimp", "Tuna", "Cod", "Lobster", "Crab", "Scallops", "Mussels", "Oysters", "Sardines", + "Trout", "Haddock", "Swordfish", "Halibut", "Mahi-Mahi", "Clams", "Catfish", "Anchovies", "Sole", "Octopus", + "Squid", "Caviar", "Sea Bass", "Herring", "Pollock", "Snapper", "Surimi", "Whitefish", +}; + +const std::array seeds = { + "Chia Seeds", "Flaxseeds", "Sunflower Seeds", "Pumpkin Seeds", "Sesame Seeds", + "Poppy Seeds", "Hemp Seeds", "Quinoa", "Pomegranate Seeds", "Pine Nuts", + "Hemp Hearts", "Sacha Inchi Seeds", "Watermelon Seeds", "Sunflower Kernels", "Safflower Seeds", + "Alfalfa Seeds", "Mustard Seeds", "Coriander Seeds", "Cumin Seeds", "Fennel Seeds", + "Cardamom Seeds", "Caraway Seeds", "Ajwain Seeds", "Nigella Seeds", "Fenugreek Seeds", + "Anise Seeds", "Celery Seeds", "Dill Seeds", "Cotton Seeds", +}; + +const std::array sugarProducts = { + "Granulated Sugar", + "Brown Sugar", + "Powdered Sugar", + "Demerara Sugar", + "Turbinado Sugar", + "Coconut Sugar", + "Maple Syrup", + "Agave Nectar", + "Molasses", + "Date Syrup", + "Golden Syrup", + "Corn Syrup", + "Barley Malt Syrup", + "Rice Syrup", + "Blackstrap Molasses", + "Palm Sugar", + "Muscovado Sugar", + "Lollipop", + "Candies", + "Chocolates", + "Cookies", + "Cakes", + "Soda", + "Ice Cream", +}; + +const std::array vegetables = { + "Carrot", "Broccoli", "Spinach", "Tomato", "Bell Pepper", "Cucumber", + "Lettuce", "Kale", "Cabbage", "Zucchini", "Eggplant", "Radish", + "Celery", "Asparagus", "Cauliflower", "Green Beans", "Peas", "Brussels Sprouts", + "Artichoke", "Sweet Potato", "Potato", "Onion", "Garlic", "Ginger", + "Mushroom", "Leek", "Scallion", "Beets", "Turnip", "Rutabaga", +}; +} diff --git a/src/modules/food/FoodData.h b/src/modules/food/FoodData.h new file mode 100644 index 000000000..276db7176 --- /dev/null +++ b/src/modules/food/FoodData.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace faker +{ +extern const std::array alcoholicBeverages; +extern const std::array dishNames; +extern const std::array foodCategories; +extern const std::array fruits; +extern const std::array grains; +extern const std::array meats; +extern const std::array milkProducts; +extern const std::array nonalcoholicBeverages; +extern const std::array nuts; +extern const std::array oils; +extern const std::array seafoods; +extern const std::array seeds; +extern const std::array sugarProducts; +extern const std::array vegetables; +} diff --git a/src/modules/food/data/AlcoholicBeverages.h b/src/modules/food/data/AlcoholicBeverages.h deleted file mode 100644 index e29ebd9cf..000000000 --- a/src/modules/food/data/AlcoholicBeverages.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector alcoholicBeverages{ - "Beer", - "Wine", - "Vodka", - "Rum", - "Gin", - "Whiskey", - "Tequila", - "Brandy", - "Champagne", - "Cider", - "Sake", - "Absinthe", - "Cognac", - "Schnapps", - "Mead", - "Bourbon", - "Scotch", - "Irish Cream", - "Jägermeister", - "Pisco", - "Port Wine", - "Sherry", - "Grappa", - "Sambuca", - "Midori", - "Kahlúa", - "Baileys Irish Cream", - "Pina Colada", - "Margarita", - "Cosmopolitan", - "Mai Tai", - "Negroni", - "Martini", - "Old Fashioned", - "Mojito", - "Caipirinha", - "Piña Colada", - "Bloody Mary", - "Tom Collins", - "Singapore Sling", - "Manhattan", - "Moscow Mule", - "Paloma", - "Bellini", - "Mimosa", - "White Russian", - "Black Russian", -}; -} diff --git a/src/modules/food/data/DishNames.h b/src/modules/food/data/DishNames.h deleted file mode 100644 index 8c2cf3ed7..000000000 --- a/src/modules/food/data/DishNames.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector dishNames = { - "Sushi", - "Paella", - "Biryani", - "Poutine", - "Kebab", - "Kimchi", - "Rendang", - "Pad Krapow Moo Saap", - "Goulash", - "Pho", - "Tacos", - "Pierogi", - "Tagine", - "Moussaka", - "Feijoada", - "Dim Sum", - "Ceviche", - "Jollof Rice", - "Pierogi", - "Borscht", - "Pavlova", - "Katsudon", - "Chimichurri", - "Laksa", - "Tandoori Chicken", - "Haggis", - "Baklava", - "Caponata", - "Tom Kha Gai", - "Ramen", - "Arroz con Pollo", - "Baklava", - "Dolma", - "Samosa", - "Bánh Mì", - "Lobster Thermidor", - "Perogies", - "Arepas", - "Nasi Goreng", - "Pav Bhaji", - "Causa Rellena", - "Baba Ganoush", - "Chicken Piccata", - "Penne alla Vodka", - "Beef and Broccoli", - "Shrimp Fried Rice", - "Butter Chicken", - "Egg Fried Rice", - "Stuffed Bell Peppers", - "Chicken Tikka Masala", - "Lemon Herb Roast Chicken", - "Shrimp Scampi Pasta", - "Beef Bulgogi", - "Tom Yum Soup", - "Chicken Katsu", - "Vegetable Curry", - "Chicken Quesadilla", - "Pho", - "Honey Garlic Glazed Salmon", - "Eggplant Rollatini", - "Lemon Butter Shrimp", - "Chicken Teriyaki", - "Mango Salsa Chicken", - "Cauliflower Fried Rice", - "Chicken Fajitas", - "Sausage and Mushroom Risotto", - "Tomato Basil Mozzarella Skewers", - "Garlic Parmesan Roasted Brussels Sprouts", - "Beef Chimichanga", - "Pulled Pork Sandwich", - "Tandoori Chicken", - "Mongolian Beef", - "Vegetarian Paella", - "Chicken Enchiladas", - "Lemon Herb Grilled Fish", - "Spinach and Feta Stuffed Chicken Breast", - "Cajun Shrimp Pasta", - "Teriyaki Salmon", - "Baked Ziti", - "Chicken Alfredo Pizza", - "Caprese Stuffed Avocado", - "Lobster Roll", - "Chicken Caesar Salad", - "Beef and Mushroom Pie", - "Garlic Herb Roasted Potatoes", -}; -} diff --git a/src/modules/food/data/FoodCategories.h b/src/modules/food/data/FoodCategories.h deleted file mode 100644 index 3fc74840f..000000000 --- a/src/modules/food/data/FoodCategories.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector foodCategories = { - "Vegetables", "Fruits", "Meat", "Seafood", "Dairy", "Grains", - "Beverages", "Desserts", "Snacks", "Condiments", "Frozen Foods", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Fruits.h b/src/modules/food/data/Fruits.h deleted file mode 100644 index 010262178..000000000 --- a/src/modules/food/data/Fruits.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector fruits = { - "Apple", "Banana", "Orange", "Strawberry", "Pineapple", "Mango", "Grapes", - "Kiwi", "Peach", "Pear", "Cherry", "Blueberry", "Raspberry", "Blackberry", - "Avocado", "Lemon", "Lime", "Grapefruit", "Cantaloupe", "Honeydew", "Pomegranate", - "Apricot", "Plum", "Nectarine", "Fig", "Papaya", "Passion Fruit", "Guava", - "Coconut", "Dragon Fruit", "Persimmon", "Cranberry", "Date", "Lychee", "Mulberry", - "Kumquat", "Jackfruit", "Starfruit", "Rambutan", "Gooseberry", "Elderberry", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Grains.h b/src/modules/food/data/Grains.h deleted file mode 100644 index 1cbd08683..000000000 --- a/src/modules/food/data/Grains.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector grains = { - "Wheat", "Rice", "Barley", "Oats", "Quinoa", "Corn", "Rye", - "Millet", "Buckwheat", "Sorghum", "Amaranth", "Triticale", "Spelt", "Farro", - "Kamut", "Emmer", "Freekeh", "Teff", "Job's Tears", "Einkorn", "Bulgur", - "Maize", "Semolina", "Soy", "Lentils", "Chia Seeds", "Flaxseeds", "Sunflower Seeds", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Meats.h b/src/modules/food/data/Meats.h deleted file mode 100644 index 445ae720d..000000000 --- a/src/modules/food/data/Meats.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector meats = { - "Chicken", "Beef", "Pork", "Lamb", "Turkey", "Fish", "Venison", "Duck", "Quail", "Goose", "Salmon", - "Shrimp", "Crab", "Lobster", "Bison", "Veal", "Haddock", "Trout", "Tuna", "Sausage", "Ham", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/MilkProducts.h b/src/modules/food/data/MilkProducts.h deleted file mode 100644 index 650198993..000000000 --- a/src/modules/food/data/MilkProducts.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector milkProducts = { - "Milk", "Cheese", "Yogurt", "Butter", "Cream", "Sour Cream", "Cottage Cheese", - "Whipped Cream", "Ice Cream", "Condensed Milk", "Evaporated Milk", "Mozzarella", "Feta", "Parmesan", - "Provolone", "Cheddar", "Gouda", "Blue Cheese", "Swiss Cheese", "Brie", "Camembert", - "Ricotta", "Goat Cheese", "Mascarpone", "Quark", "Havarti", "Colby", "Monterey Jack", - "Gruyère", "Havarti", "Cream Cheese", "Neufchâtel", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/NonalcoholicBeverages.h b/src/modules/food/data/NonalcoholicBeverages.h deleted file mode 100644 index 777e1bd37..000000000 --- a/src/modules/food/data/NonalcoholicBeverages.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector nonalcoholicBeverages = { - "Water", - "Tea", - "Coffee", - "Milk", - "Orange Juice", - "Apple Juice", - "Lemonade", - "Iced Tea", - "Cranberry Juice", - "Grape Juice", - "Pineapple Juice", - "Coconut Water", - "Tomato Juice", - "Ginger Ale", - "Hot Chocolate", - "Limeade", - "Grapefruit Juice", - "Club Soda", - "Root Beer", - "Fruit Punch", - "Pomegranate Juice", - "Chai Tea", - "Almond Milk", - "Soy Milk", - "Raspberry Lemonade", - "Peach Iced Tea", - "Hibiscus Tea", - "Green Smoothie", - "Vegetable Juice", - "Pear Nectar", - "Mango Lassi", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Nuts.h b/src/modules/food/data/Nuts.h deleted file mode 100644 index abe7f007f..000000000 --- a/src/modules/food/data/Nuts.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector nuts = { - "Almond", "Walnut", "Pecan", "Cashew", "Pistachio", "Hazelnut", - "Macadamia", "Brazil Nut", "Pine Nut", "Chestnut", "Peanut", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Oils.h b/src/modules/food/data/Oils.h deleted file mode 100644 index 3d526c144..000000000 --- a/src/modules/food/data/Oils.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector oils = { - "Olive Oil", "Coconut Oil", "Vegetable Oil", "Canola Oil", "Sesame Oil", "Sunflower Oil", "Peanut Oil", - "Grapeseed Oil", "Avocado Oil", "Corn Oil", "Flaxseed Oil", "Walnut Oil", "Safflower Oil", "Hazelnut Oil", - "Almond Oil", "Palm Oil", "Mustard Oil", "Chia Seed Oil", "Hemp Oil", "Pumpkin Seed Oil", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Seafoods.h b/src/modules/food/data/Seafoods.h deleted file mode 100644 index d74447126..000000000 --- a/src/modules/food/data/Seafoods.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector seafoods = { - "Salmon", "Shrimp", "Tuna", "Cod", "Lobster", "Crab", "Scallops", "Mussels", "Oysters", "Sardines", - "Trout", "Haddock", "Swordfish", "Halibut", "Mahi-Mahi", "Clams", "Catfish", "Anchovies", "Sole", "Octopus", - "Squid", "Caviar", "Sea Bass", "Herring", "Pollock", "Snapper", "Surimi", "Whitefish", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/Seeds.h b/src/modules/food/data/Seeds.h deleted file mode 100644 index 409e0626d..000000000 --- a/src/modules/food/data/Seeds.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector seeds = { - "Chia Seeds", "Flaxseeds", "Sunflower Seeds", "Pumpkin Seeds", "Sesame Seeds", - "Poppy Seeds", "Hemp Seeds", "Quinoa", "Pomegranate Seeds", "Pine Nuts", - "Hemp Hearts", "Sacha Inchi Seeds", "Watermelon Seeds", "Sunflower Kernels", "Safflower Seeds", - "Alfalfa Seeds", "Mustard Seeds", "Coriander Seeds", "Cumin Seeds", "Fennel Seeds", - "Cardamom Seeds", "Caraway Seeds", "Ajwain Seeds", "Nigella Seeds", "Fenugreek Seeds", - "Anise Seeds", "Celery Seeds", "Dill Seeds", "Cotton Seeds", -}; -} \ No newline at end of file diff --git a/src/modules/food/data/SugarProducts.h b/src/modules/food/data/SugarProducts.h deleted file mode 100644 index 2fe01de40..000000000 --- a/src/modules/food/data/SugarProducts.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector sugarProducts = { - "Granulated Sugar", - "Brown Sugar", - "Powdered Sugar", - "Demerara Sugar", - "Turbinado Sugar", - "Coconut Sugar", - "Maple Syrup", - "Agave Nectar", - "Molasses", - "Date Syrup", - "Golden Syrup", - "Corn Syrup", - "Barley Malt Syrup", - "Rice Syrup", - "Blackstrap Molasses", - "Palm Sugar", - "Muscovado Sugar", - "Lollipop", - "Candies", - "Chocolates", - "Cookies", - "Cakes", - "Soda", - "Ice Cream", -}; -} diff --git a/src/modules/food/data/Vegetables.h b/src/modules/food/data/Vegetables.h deleted file mode 100644 index 09a010616..000000000 --- a/src/modules/food/data/Vegetables.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -namespace faker -{ -const std::vector vegetables = { - "Carrot", "Broccoli", "Spinach", "Tomato", "Bell Pepper", "Cucumber", - "Lettuce", "Kale", "Cabbage", "Zucchini", "Eggplant", "Radish", - "Celery", "Asparagus", "Cauliflower", "Green Beans", "Peas", "Brussels Sprouts", - "Artichoke", "Sweet Potato", "Potato", "Onion", "Garlic", "Ginger", - "Mushroom", "Leek", "Scallion", "Beets", "Turnip", "Rutabaga", -}; -} \ No newline at end of file diff --git a/tests/modules/food/FoodTest.cpp b/tests/modules/food/FoodTest.cpp index a44279a3a..affef4387 100644 --- a/tests/modules/food/FoodTest.cpp +++ b/tests/modules/food/FoodTest.cpp @@ -4,20 +4,7 @@ #include "gtest/gtest.h" -#include "food/data/AlcoholicBeverages.h" -#include "food/data/DishNames.h" -#include "food/data/FoodCategories.h" -#include "food/data/Fruits.h" -#include "food/data/Grains.h" -#include "food/data/Meats.h" -#include "food/data/MilkProducts.h" -#include "food/data/NonalcoholicBeverages.h" -#include "food/data/Nuts.h" -#include "food/data/Oils.h" -#include "food/data/Seafoods.h" -#include "food/data/Seeds.h" -#include "food/data/SugarProducts.h" -#include "food/data/Vegetables.h" +#include "food/FoodData.h" using namespace ::testing; using namespace faker; @@ -32,7 +19,7 @@ TEST_F(FoodTest, shouldGenerateAlcoholicBeverage) const auto generatedAlcoholicBeverage = Food::alcoholicBeverage(); ASSERT_TRUE(std::ranges::any_of(alcoholicBeverages, - [generatedAlcoholicBeverage](const std::string& alcoholicBeverage) + [generatedAlcoholicBeverage](const std::string_view& alcoholicBeverage) { return generatedAlcoholicBeverage == alcoholicBeverage; })); } @@ -40,7 +27,7 @@ TEST_F(FoodTest, shouldGenerateDishName) { const auto generatedDishName = Food::dishName(); - ASSERT_TRUE(std::ranges::any_of(dishNames, [generatedDishName](const std::string& dishName) + ASSERT_TRUE(std::ranges::any_of(dishNames, [generatedDishName](const std::string_view& dishName) { return generatedDishName == dishName; })); } @@ -48,7 +35,7 @@ TEST_F(FoodTest, shouldGenerateFoodCategories) { const auto generatedFoodCategory = Food::foodCategory(); - ASSERT_TRUE(std::ranges::any_of(foodCategories, [generatedFoodCategory](const std::string& foodCategory) + ASSERT_TRUE(std::ranges::any_of(foodCategories, [generatedFoodCategory](const std::string_view& foodCategory) { return generatedFoodCategory == foodCategory; })); } @@ -56,22 +43,23 @@ TEST_F(FoodTest, shouldGenerateFruit) { const auto generatedFruit = Food::fruit(); - ASSERT_TRUE( - std::ranges::any_of(fruits, [generatedFruit](const std::string& fruit) { return generatedFruit == fruit; })); + ASSERT_TRUE(std::ranges::any_of(fruits, [generatedFruit](const std::string_view& fruit) + { return generatedFruit == fruit; })); } TEST_F(FoodTest, shouldGenerateMeat) { const auto generatedMeat = Food::meat(); - ASSERT_TRUE(std::ranges::any_of(meats, [generatedMeat](const std::string& meat) { return generatedMeat == meat; })); + ASSERT_TRUE( + std::ranges::any_of(meats, [generatedMeat](const std::string_view& meat) { return generatedMeat == meat; })); } TEST_F(FoodTest, shouldGenerateMilkProduct) { const auto generatedMilkProduct = Food::milkProduct(); - ASSERT_TRUE(std::ranges::any_of(milkProducts, [generatedMilkProduct](const std::string& milkProduct) + ASSERT_TRUE(std::ranges::any_of(milkProducts, [generatedMilkProduct](const std::string_view& milkProduct) { return generatedMilkProduct == milkProduct; })); } @@ -80,7 +68,7 @@ TEST_F(FoodTest, shouldGenerateNonalcoholicBeverages) const auto generatedNonalcoholicBeverages = Food::nonalcoholicBeverage(); ASSERT_TRUE(std::ranges::any_of(nonalcoholicBeverages, - [generatedNonalcoholicBeverages](const std::string& nonalcoholicBeverage) + [generatedNonalcoholicBeverages](const std::string_view& nonalcoholicBeverage) { return generatedNonalcoholicBeverages == nonalcoholicBeverage; })); } @@ -88,21 +76,21 @@ TEST_F(FoodTest, shouldGenerateNut) { const auto generatedNut = Food::nut(); - ASSERT_TRUE(std::ranges::any_of(nuts, [generatedNut](const std::string& nut) { return generatedNut == nut; })); + ASSERT_TRUE(std::ranges::any_of(nuts, [generatedNut](const std::string_view& nut) { return generatedNut == nut; })); } TEST_F(FoodTest, shouldGenerateOil) { const auto generatedOil = Food::oil(); - ASSERT_TRUE(std::ranges::any_of(oils, [generatedOil](const std::string& oil) { return generatedOil == oil; })); + ASSERT_TRUE(std::ranges::any_of(oils, [generatedOil](const std::string_view& oil) { return generatedOil == oil; })); } TEST_F(FoodTest, shouldGenerateSeafood) { const auto generatedSeafood = Food::seafood(); - ASSERT_TRUE(std::ranges::any_of(seafoods, [generatedSeafood](const std::string& seafood) + ASSERT_TRUE(std::ranges::any_of(seafoods, [generatedSeafood](const std::string_view& seafood) { return generatedSeafood == seafood; })); } @@ -110,22 +98,23 @@ TEST_F(FoodTest, shouldGenerateSeed) { const auto generatedSeed = Food::seed(); - ASSERT_TRUE(std::ranges::any_of(seeds, [generatedSeed](const std::string& seed) { return generatedSeed == seed; })); + ASSERT_TRUE( + std::ranges::any_of(seeds, [generatedSeed](const std::string_view& seed) { return generatedSeed == seed; })); } TEST_F(FoodTest, shouldGenerateGrain) { const auto generatedGrain = Food::grain(); - ASSERT_TRUE( - std::ranges::any_of(grains, [generatedGrain](const std::string& grain) { return generatedGrain == grain; })); + ASSERT_TRUE(std::ranges::any_of(grains, [generatedGrain](const std::string_view& grain) + { return generatedGrain == grain; })); } TEST_F(FoodTest, shouldGenerateSugarProduct) { const auto generatedSugarProduct = Food::sugarProduct(); - ASSERT_TRUE(std::ranges::any_of(sugarProducts, [generatedSugarProduct](const std::string& sugarProduct) + ASSERT_TRUE(std::ranges::any_of(sugarProducts, [generatedSugarProduct](const std::string_view& sugarProduct) { return generatedSugarProduct == sugarProduct; })); } @@ -133,6 +122,6 @@ TEST_F(FoodTest, shouldGenerateVegetable) { const auto generatedVegetable = Food::vegetable(); - ASSERT_TRUE(std::ranges::any_of(vegetables, [generatedVegetable](const std::string& vegetable) + ASSERT_TRUE(std::ranges::any_of(vegetables, [generatedVegetable](const std::string_view& vegetable) { return generatedVegetable == vegetable; })); }