diff --git a/include/faker-cxx/types/Country.h b/include/faker-cxx/types/Country.h index e03de92a0..0d69dd8de 100644 --- a/include/faker-cxx/types/Country.h +++ b/include/faker-cxx/types/Country.h @@ -26,14 +26,15 @@ enum class Country Ukraine, Denmark, Sweden, - Brazil + Brazil, + Norway }; const std::vector countries{Country::Usa, Country::England, Country::Poland, Country::Italy, Country::France, Country::Germany, Country::Russia, Country::Romania, Country::India, Country::Finland, Country::Nepal, Country::Spain, Country::Turkey, Country::Czech, Country::Slovakia, Country::Ukraine, - Country::Denmark, Country::Sweden, Country::Brazil}; + Country::Denmark, Country::Sweden, Country::Brazil, Country::Norway}; inline std::string toString(Country country) { @@ -44,7 +45,7 @@ inline std::string toString(Country country) {Country::Finland, "Finland"}, {Country::Nepal, "Nepal"}, {Country::Spain, "Spain"}, {Country::Turkey, "Turkey"}, {Country::Czech, "Czech"}, {Country::Slovakia, "Slovakia"}, {Country::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"}, - {Country::Brazil, "Brazil"}}; + {Country::Brazil, "Brazil"}, {Country::Norway, "Norway"}}; return countryToStringMapping.at(country); } diff --git a/src/modules/person/Person.cpp b/src/modules/person/Person.cpp index 658de1f40..e315d06b2 100644 --- a/src/modules/person/Person.cpp +++ b/src/modules/person/Person.cpp @@ -19,6 +19,7 @@ #include "data/JobTitles.h" #include "data/Nationalities.h" #include "data/nepal/NepalesePeopleNames.h" +#include "data/norway/NorwegianPeopleNames.h" #include "data/poland/PolishPeopleNames.h" #include "data/romania/RomanianPeopleNames.h" #include "data/russia/RussianPeopleNames.h" @@ -48,7 +49,7 @@ const std::map countryToPeopleNamesMapping{ {Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames}, {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, - {Country::Brazil, brazilianPeopleNames}}; + {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}}; std::string middleNameForCountry(Country country, std::optional sex); std::string prefixForCountry(Country country, std::optional sex); diff --git a/src/modules/person/PersonTest.cpp b/src/modules/person/PersonTest.cpp index 5ccc9af8f..ffac752a4 100644 --- a/src/modules/person/PersonTest.cpp +++ b/src/modules/person/PersonTest.cpp @@ -18,6 +18,7 @@ #include "data/JobTitles.h" #include "data/Nationalities.h" #include "data/nepal/NepalesePeopleNames.h" +#include "data/norway/NorwegianPeopleNames.h" #include "data/poland/PolishPeopleNames.h" #include "data/romania/RomanianPeopleNames.h" #include "data/russia/RussianPeopleNames.h" @@ -48,7 +49,7 @@ const std::map countryToPeopleNamesMapping{ {Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames}, {Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames}, {Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}, - {Country::Brazil, brazilianPeopleNames}}; + {Country::Brazil, brazilianPeopleNames}, {Country::Norway, norwegianPeopleNames}}; const std::map generatedTestName{ {Country::England, "shouldGenerateEnglishName"}, {Country::France, "shouldGenerateFrenchName"}, @@ -60,7 +61,7 @@ const std::map generatedTestName{ {Country::Czech, "shouldGenerateCzechName"}, {Country::Slovakia, "shouldGenerateSlovakName"}, {Country::Ukraine, "shouldGenerateUkrainianName"}, {Country::Denmark, "shouldGenerateDanishName"}, {Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"}, - {Country::Brazil, "shouldGenerateBrazilianName"}}; + {Country::Brazil, "shouldGenerateBrazilianName"}, {Country::Norway, "shouldGenerateNorwegianName"}}; } class PersonTest : public TestWithParam diff --git a/src/modules/person/data/norway/NorwegianFirstNames.h b/src/modules/person/data/norway/NorwegianFirstNames.h new file mode 100644 index 000000000..97b6b73c6 --- /dev/null +++ b/src/modules/person/data/norway/NorwegianFirstNames.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector norwegianMalesFirstNames = { + "Markus", "Mathias", "Kristian", "Jonas", "Andreas", "Alexander", "Martin", "Sander", "Daniel", "Magnus", + "Henrik", "Tobias", "Kristoffer", "Emil", "Adrian", "Sebastian", "Marius", "Elias", "Fredrik", "Thomas", + "Sondre", "Benjamin", "Jakob", "Oliver", "Lucas", "Oskar", "Nikolai", "Filip", "Mats", "William", + "Erik", "Simen", "Ole", "Eirik", "Isak", "Kasper", "Noah", "Lars", "Joakim", "Johannes", + "Håkon", "Sindre", "Jørgen", "Herman", "Anders", "Jonathan", "Even", "Theodor", "Mikkel", "Aksel"}; + +const std::vector norwegianFemalesFirstNames = { + "Emma", "Sara", "Thea", "Ida", "Julie", "Nora", "Emilie", "Ingrid", "Hanna", "Maria", + "Sofie", "Anna", "Malin", "Amalie", "Vilde", "Frida", "Andrea", "Tuva", "Victoria", "Mia", + "Karoline", "Mathilde", "Martine", "Linnea", "Marte", "Hedda", "Marie", "Helene", "Silje", "Leah", + "Maja", "Elise", "Oda", "Kristine", "Aurora", "Kaja", "Camilla", "Mari", "Maren", "Mina", + "Selma", "Jenny", "Celine", "Eline", "Sunniva", "Natalie", "Tiril", "Synne", "Sandra", "Madeleine"}; +} diff --git a/src/modules/person/data/norway/NorwegianLastNames.h b/src/modules/person/data/norway/NorwegianLastNames.h new file mode 100644 index 000000000..3c61e5735 --- /dev/null +++ b/src/modules/person/data/norway/NorwegianLastNames.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector norwegianLastNames = { + "Johansen", "Hansen", "Andersen", "Kristiansen", "Larsen", "Olsen", "Solberg", + "Andresen", "Pedersen", "Nilsen", "Berg", "Halvorsen", "Karlsen", "Svendsen", + "Jensen", "Haugen", "Martinsen", "Eriksen", "Sørensen", "Johnsen", "Myhrer", + "Johannessen", "Nielsen", "Hagen", "Pettersen", "Bakke", "Skuterud", "Løken", + "Gundersen", "Strand", "Jørgensen", "Kvarme", "Røed", "Sæther", "Stensrud", + "Moe", "Kristoffersen", "Jakobsen", "Holm", "Aas", "Lie", "Moen", + "Andreassen", "Vedvik", "Nguyen", "Jacobsen", "Torgersen", "Ruud", "Krogh", + "Christiansen", "Bjerke", "Aalerud", "Borge", "Sørlie", "Berge", "Østli", + "Ødegård", "Torp", "Henriksen", "Haukelidsæter", "Fjeld", "Danielsen", "Aasen", + "Fredriksen", "Dahl", "Berntsen", "Arnesen", "Wold", "Thoresen", "Solheim", + "Skoglund", "Bakken", "Amundsen", "Solli", "Smogeli", "Kristensen", "Glosli", + "Fossum", "Evensen", "Eide", "Carlsen", "Østby", "Vegge", "Tangen", + "Smedsrud", "Olstad", "Lunde", "Kleven", "Huseby", "Bjørnstad", "Ryan", + "Rasmussen", "Nygård", "Nordskaug", "Nordby", "Mathisen", "Hopland", "Gran", + "Finstad", "Edvardsen"}; +} diff --git a/src/modules/person/data/norway/NorwegianPeopleNames.h b/src/modules/person/data/norway/NorwegianPeopleNames.h new file mode 100644 index 000000000..092c052fd --- /dev/null +++ b/src/modules/person/data/norway/NorwegianPeopleNames.h @@ -0,0 +1,20 @@ +#pragma once + +#include "../NameFormats.h" +#include "../PeopleNames.h" +#include "NorwegianFirstNames.h" +#include "NorwegianLastNames.h" +#include "NorwegianPrefixes.h" +#include "NorwegianSuffixes.h" + +namespace faker +{ +const NameFormats norwegianPersonNameFormats{ + {{"{prefix} {firstName} {lastName}", 1}, {"{firstName} {lastName}", 9}, {"{firstName} {lastName} {suffix}", 1}}}; + +const PeopleNames norwegianPeopleNames{ + {norwegianMalesFirstNames, {}, norwegianLastNames, norwegianPrefixes, norwegianSuffixes}, + {norwegianFemalesFirstNames, {}, norwegianLastNames, norwegianPrefixes, norwegianSuffixes}, + norwegianPersonNameFormats}; + +} diff --git a/src/modules/person/data/norway/NorwegianPrefixes.h b/src/modules/person/data/norway/NorwegianPrefixes.h new file mode 100644 index 000000000..e63a53858 --- /dev/null +++ b/src/modules/person/data/norway/NorwegianPrefixes.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector norwegianPrefixes{"Dr.", "Prof."}; +} diff --git a/src/modules/person/data/norway/NorwegianSuffixes.h b/src/modules/person/data/norway/NorwegianSuffixes.h new file mode 100644 index 000000000..344e6e3fa --- /dev/null +++ b/src/modules/person/data/norway/NorwegianSuffixes.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +namespace faker +{ +const std::vector norwegianSuffixes{"Jr.", "Sr.", "I", "II", "III", "IV", "V"}; +}