Skip to content

Commit

Permalink
add brazilian people names
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal committed Nov 16, 2023
1 parent d9264f7 commit c5c59e7
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 9 deletions.
15 changes: 9 additions & 6 deletions include/faker-cxx/types/Country.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ enum class Country
Slovakia,
Ukraine,
Denmark,
Sweden
Sweden,
Brazil
};

const std::vector<Country> 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};
const std::vector<Country> 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};

inline std::string toString(Country country)
{
Expand All @@ -41,7 +43,8 @@ inline std::string toString(Country country)
{Country::Russia, "Russia"}, {Country::Romania, "Romania"}, {Country::India, "India"},
{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::Ukraine, "Ukraine"}, {Country::Denmark, "Denmark"}, {Country::Sweden, "Sweden"},
{Country::Brazil, "Brazil"}};

return countryToStringMapping.at(country);
}
Expand Down
4 changes: 3 additions & 1 deletion src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <set>

#include "../../common/FormatHelper.h"
#include "data/brazil/BrazilianPeopleNames.h"
#include "data/czech/CzechPeopleNames.h"
#include "data/denmark/DanishPeopleNames.h"
#include "data/england/EnglishPeopleNames.h"
Expand Down Expand Up @@ -46,7 +47,8 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Spain, spanishPeopleNames}, {Country::Turkey, turkishPeopleNames},
{Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames},
{Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames},
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}};
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames},
{Country::Brazil, brazilianPeopleNames}};

std::string middleNameForCountry(Country country, std::optional<Sex> sex);
std::string prefixForCountry(Country country, std::optional<Sex> sex);
Expand Down
7 changes: 5 additions & 2 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "data/turkey/TurkishPeopleNames.h"
#include "data/ukraine/UkrainianPeopleNames.h"
#include "data/ZodiacSigns.h"
#include "src/modules/person/data/brazil/BrazilianPeopleNames.h"
#include "src/modules/person/data/PeopleNames.h"
#include "src/modules/person/data/usa/UsaPeopleNames.h"

Expand All @@ -46,7 +47,8 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Spain, spanishPeopleNames}, {Country::Turkey, turkishPeopleNames},
{Country::Czech, czechPeopleNames}, {Country::Slovakia, slovakPeopleNames},
{Country::Ukraine, ukrainianPeopleNames}, {Country::Denmark, danishPeopleNames},
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames}};
{Country::Sweden, swedishPeopleNames}, {Country::Usa, usaPeopleNames},
{Country::Brazil, brazilianPeopleNames}};

const std::map<Country, std::string> generatedTestName{
{Country::England, "shouldGenerateEnglishName"}, {Country::France, "shouldGenerateFrenchName"},
Expand All @@ -57,7 +59,8 @@ const std::map<Country, std::string> generatedTestName{
{Country::Spain, "shouldGenerateSpanishName"}, {Country::Turkey, "shouldGenerateTurkishName"},
{Country::Czech, "shouldGenerateCzechName"}, {Country::Slovakia, "shouldGenerateSlovakName"},
{Country::Ukraine, "shouldGenerateUkrainianName"}, {Country::Denmark, "shouldGenerateDanishName"},
{Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"}};
{Country::Sweden, "shouldGenerateSwedishName"}, {Country::Usa, "shouldGenerateAmericanName"},
{Country::Brazil, "shouldGenerateBrazilianName"}};
}

class PersonTest : public TestWithParam<Country>
Expand Down
34 changes: 34 additions & 0 deletions src/modules/person/data/brazil/BrazilianFirstNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> brazilianMalesFirstNames = {
"Alessandro", "Alexandre", "Anthony", "Antônio", "Arthur", "Benjamin", "Benício", "Bernardo",
"Breno", "Bryan", "Caio", "Calebe", "Carlos", "Cauã", "César", "Daniel",
"Danilo", "Davi", "Davi Lucca", "Deneval", "Eduardo", "Elísio", "Emanuel", "Enzo",
"Enzo Gabriel", "Fabiano", "Fabrício", "Feliciano", "Felipe", "Frederico", "Fábio", "Félix",
"Gabriel", "Gael", "Guilherme", "Gustavo", "Gúbio", "Heitor", "Henrique", "Hugo",
"Hélio", "Isaac", "Joaquim", "João", "João Lucas", "João Miguel", "João Pedro", "Júlio",
"Júlio César", "Kléber", "Ladislau", "Leonardo", "Lorenzo", "Lucas", "Lucca", "Marcelo",
"Marcos", "Matheus", "Miguel", "Murilo", "Nataniel", "Nicolas", "Noah", "Norberto",
"Pablo", "Paulo", "Pedro", "Pedro Henrique", "Pietro", "Rafael", "Raul", "Ricardo",
"Roberto", "Salvador", "Samuel", "Silas", "Sirineu", "Tertuliano", "Théo", "Vicente",
"Vitor", "Víctor", "Warley", "Washington", "Yago", "Yango", "Yuri", "Ígor"};

const std::vector<std::string> brazilianFemalesFirstNames = {
"Alessandra", "Alice", "Aline", "Alícia", "Ana Clara", "Ana Júlia", "Ana Laura",
"Ana Luiza", "Antonella", "Beatriz", "Bruna", "Carla", "Cecília", "Clara",
"Célia", "Dalila", "Eduarda", "Elisa", "Eloá", "Emanuelly", "Esther",
"Fabrícia", "Felícia", "Giovanna", "Helena", "Heloísa", "Isabel", "Isabela",
"Isabella", "Isabelly", "Isis", "Janaína", "Joana", "Júlia", "Karla",
"Lara", "Larissa", "Laura", "Lavínia", "Liz", "Lorena", "Lorraine",
"Luiza", "Lívia", "Maitê", "Manuela", "Marcela", "Margarida", "Maria",
"Maria Alice", "Maria Cecília", "Maria Clara", "Maria Eduarda", "Maria Helena", "Maria Júlia", "Maria Luiza",
"Mariana", "Marina", "Marli", "Meire", "Melissa", "Morgana", "Márcia",
"Mércia", "Natália", "Núbia", "Ofélia", "Paula", "Rafaela", "Rebeca",
"Roberta", "Sara", "Sarah", "Sophia", "Suélen", "Sílvia", "Talita",
"Valentina", "Vitória", "Yasmin"};
}
12 changes: 12 additions & 0 deletions src/modules/person/data/brazil/BrazilianLastNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> brazilianLastNames = {
"Silva", "Souza", "Carvalho", "Santos", "Reis", "Xavier", "Franco",
"Braga", "Macedo", "Batista", "Barros", "Moraes", "Costa", "Pereira",
"Melo", "Saraiva", "Nogueira", "Oliveira", "Martins", "Moreira", "Albuquerque"};
}
20 changes: 20 additions & 0 deletions src/modules/person/data/brazil/BrazilianPeopleNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include "../NameFormats.h"
#include "../PeopleNames.h"
#include "BrazilianFirstNames.h"
#include "BrazilianLastNames.h"
#include "BrazilianPrefixes.h"
#include "BrazilianSuffixes.h"

namespace faker
{
const NameFormats brazilianPersonNameFormats{
{{"{prefix} {firstName} {lastName}", 1}, {"{firstName} {lastName}", 9}, {"{firstName} {lastName} {suffix}", 1}}};

const PeopleNames brazilianPeopleNames{
{brazilianMalesFirstNames, {}, brazilianLastNames, brazilianMalesPrefixes, brazilianSuffixes},
{brazilianFemalesFirstNames, {}, brazilianLastNames, brazilianFemalesPrefixes, brazilianSuffixes},
brazilianPersonNameFormats};

}
11 changes: 11 additions & 0 deletions src/modules/person/data/brazil/BrazilianPrefixes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> brazilianMalesPrefixes{"Sr.", "Dr."};

const std::vector<std::string> brazilianFemalesPrefixes{"Sra.", "Srta.", "Dra."};
}
9 changes: 9 additions & 0 deletions src/modules/person/data/brazil/BrazilianSuffixes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> brazilianSuffixes{"Jr.", "Neto", "Filho"};
}

0 comments on commit c5c59e7

Please sign in to comment.