Skip to content

Commit

Permalink
add danish people names (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Nov 14, 2023
1 parent 31c9686 commit 0f7998c
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 29 deletions.
12 changes: 7 additions & 5 deletions include/faker-cxx/types/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ enum class Language
Czech,
Slovak,
Ukrainian,
Danish
};

const std::vector<Language> languages{Language::English, Language::Polish, Language::Italian, Language::French,
Language::German, Language::Russian, Language::Romanian, Language::Hindi,
Language::Finnish, Language::Nepali, Language::Spanish, Language::Turkish,
Language::Czech, Language::Slovak, Language::Ukrainian};
const std::vector<Language> languages{Language::English, Language::Polish, Language::Italian, Language::French,
Language::German, Language::Russian, Language::Romanian, Language::Hindi,
Language::Finnish, Language::Nepali, Language::Spanish, Language::Turkish,
Language::Czech, Language::Slovak, Language::Ukrainian, Language::Danish};

inline std::string toString(Language language)
{
Expand All @@ -36,7 +37,8 @@ inline std::string toString(Language language)
{Language::French, "French"}, {Language::German, "German"}, {Language::Russian, "Russian"},
{Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}, {Language::Finnish, "Finnish"},
{Language::Nepali, "Nepali"}, {Language::Spanish, "Spanish"}, {Language::Turkish, "Turkish"},
{Language::Czech, "Czech"}, {Language::Slovak, "Slovak"}, {Language::Ukrainian, "Ukrainian"}};
{Language::Czech, "Czech"}, {Language::Slovak, "Slovak"}, {Language::Ukrainian, "Ukrainian"},
{Language::Danish, "Danish"}};

return languageToStringMapping.at(language);
}
Expand Down
17 changes: 9 additions & 8 deletions src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "../../common/StringHelper.h"
#include "data/czech/CzechPeopleNames.h"
#include "data/danish/DanishPeopleNames.h"
#include "data/english/EnglishPeopleNames.h"
#include "data/finnish/FinnishPeopleNames.h"
#include "data/french/FrenchPeopleNames.h"
Expand Down Expand Up @@ -34,14 +35,14 @@ namespace
const std::vector<std::string> sexes{"Male", "Female"};

const std::map<Language, PeopleNames> languageToPeopleNamesMapping{
{Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames},
{Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames},
{Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames},
{Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames},
{Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames},
{Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames},
{Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames},
{Language::Ukrainian, ukrainianPeopleNames}};
{Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames},
{Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames},
{Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames},
{Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames},
{Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames},
{Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames},
{Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames},
{Language::Ukrainian, ukrainianPeopleNames}, {Language::Danish, danishPeopleNames}};

std::string middleNameForLanguage(Language language, std::optional<Sex> sex);
std::string prefixForLanguage(Language language, std::optional<Sex> sex);
Expand Down
33 changes: 17 additions & 16 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "../../common/StringHelper.h"
#include "data/czech/CzechPeopleNames.h"
#include "data/danish/DanishPeopleNames.h"
#include "data/english/EnglishPeopleNames.h"
#include "data/finnish/FinnishPeopleNames.h"
#include "data/french/FrenchPeopleNames.h"
Expand Down Expand Up @@ -35,24 +36,24 @@ namespace
const std::vector<std::string> sexes{"Male", "Female"};

const std::map<Language, PeopleNames> languageToPeopleNamesMapping{
{Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames},
{Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames},
{Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames},
{Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames},
{Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames},
{Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames},
{Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames},
{Language::Ukrainian, ukrainianPeopleNames}};
{Language::English, englishPeopleNames}, {Language::French, frenchPeopleNames},
{Language::German, germanPeopleNames}, {Language::Italian, italianPeopleNames},
{Language::Polish, polishPeopleNames}, {Language::Russian, russianPeopleNames},
{Language::Romanian, romanianPeopleNames}, {Language::Hindi, indianPeopleNames},
{Language::Finnish, finnishPeopleNames}, {Language::Nepali, nepalesePeopleNames},
{Language::Spanish, spanishPeopleNames}, {Language::Turkish, turkishPeopleNames},
{Language::Czech, czechPeopleNames}, {Language::Slovak, slovakPeopleNames},
{Language::Ukrainian, ukrainianPeopleNames}, {Language::Danish, danishPeopleNames}};

const std::map<Language, std::string> generatedTestName{
{Language::English, "shouldGenerateEnglishName"}, {Language::French, "shouldGenerateFrenchName"},
{Language::German, "shouldGenerateGermanName"}, {Language::Italian, "shouldGenerateItalianName"},
{Language::Polish, "shouldGeneratePolishName"}, {Language::Russian, "shouldGenerateRussianName"},
{Language::Romanian, "shouldGenerateRomanianName"}, {Language::Hindi, "shouldGenerateIndianName"},
{Language::Finnish, "shouldGenerateFinnishName"}, {Language::Nepali, "shouldGenerateNepaleseName"},
{Language::Spanish, "shouldGenerateSpanishName"}, {Language::Turkish, "shouldGenerateTurkishName"},
{Language::Czech, "shouldGenerateCzechName"}, {Language::Slovak, "shouldGenerateSlovakName"},
{Language::Ukrainian, "shouldGenerateUkrainianName"}};
{Language::English, "shouldGenerateEnglishName"}, {Language::French, "shouldGenerateFrenchName"},
{Language::German, "shouldGenerateGermanName"}, {Language::Italian, "shouldGenerateItalianName"},
{Language::Polish, "shouldGeneratePolishName"}, {Language::Russian, "shouldGenerateRussianName"},
{Language::Romanian, "shouldGenerateRomanianName"}, {Language::Hindi, "shouldGenerateIndianName"},
{Language::Finnish, "shouldGenerateFinnishName"}, {Language::Nepali, "shouldGenerateNepaleseName"},
{Language::Spanish, "shouldGenerateSpanishName"}, {Language::Turkish, "shouldGenerateTurkishName"},
{Language::Czech, "shouldGenerateCzechName"}, {Language::Slovak, "shouldGenerateSlovakName"},
{Language::Ukrainian, "shouldGenerateUkrainianName"}, {Language::Danish, "shouldGenerateDanishName"}};
}

class PersonTest : public TestWithParam<Language>
Expand Down
Loading

0 comments on commit 0f7998c

Please sign in to comment.