Skip to content

Commit

Permalink
add switzerland names (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Nov 18, 2023
1 parent 0de1170 commit a5d2012
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 17 deletions.
34 changes: 20 additions & 14 deletions include/faker-cxx/types/Country.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,34 @@ enum class Country
Greece,
Slovenia,
Austria,
Switzerland,
};

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, Country::Norway, Country::Japan, Country::Portugal, Country::Hungary, Country::Croatia,
Country::Greece, Country::Slovenia, Country::Austria,
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::Norway, Country::Japan, Country::Portugal, Country::Hungary, Country::Croatia,
Country::Greece, Country::Slovenia, Country::Austria, Country::Switzerland,
};

inline std::string toString(Country country)
{
std::map<Country, std::string> countryToStringMapping{
{Country::Usa, "Usa"}, {Country::England, "England"}, {Country::Poland, "Poland"},
{Country::Italy, "Italy"}, {Country::France, "France"}, {Country::Germany, "Germany"},
{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::Brazil, "Brazil"}, {Country::Norway, "Norway"}, {Country::Japan, "Japan"},
{Country::Portugal, "Portugal"}, {Country::Hungary, "Hungary"}, {Country::Croatia, "Croatia"},
{Country::Greece, "Greece"}, {Country::Slovenia, "Slovenia"}, {Country::Austria, "Austria"},
{Country::Usa, "Usa"}, {Country::England, "England"},
{Country::Poland, "Poland"}, {Country::Italy, "Italy"},
{Country::France, "France"}, {Country::Germany, "Germany"},
{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::Brazil, "Brazil"}, {Country::Norway, "Norway"},
{Country::Japan, "Japan"}, {Country::Portugal, "Portugal"},
{Country::Hungary, "Hungary"}, {Country::Croatia, "Croatia"},
{Country::Greece, "Greece"}, {Country::Slovenia, "Slovenia"},
{Country::Austria, "Austria"}, {Country::Switzerland, "Switzerland"},
};

return countryToStringMapping.at(country);
Expand Down
3 changes: 2 additions & 1 deletion src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "data/slovenia/SlovenianPeopleNames.h"
#include "data/spain/SpanishPeopleNames.h"
#include "data/sweden/SwedishPeopleNames.h"
#include "data/switzerland/SwissPeopleNames.h"
#include "data/turkey/TurkishPeopleNames.h"
#include "data/ukraine/UkrainianPeopleNames.h"
#include "data/usa/UsaPeopleNames.h"
Expand Down Expand Up @@ -61,7 +62,7 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames},
{Country::Hungary, hungarianPeopleNames}, {Country::Croatia, croatianPeopleNames},
{Country::Greece, greekPeopleNames}, {Country::Slovenia, slovenianPeopleNames},
{Country::Austria, austrianPeopleNames},
{Country::Austria, austrianPeopleNames}, {Country::Switzerland, swissPeopleNames},
};

std::string middleNameForCountry(Country country, std::optional<Sex> sex);
Expand Down
5 changes: 3 additions & 2 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "data/slovenia/SlovenianPeopleNames.h"
#include "data/spain/SpanishPeopleNames.h"
#include "data/sweden/SwedishPeopleNames.h"
#include "data/switzerland/SwissPeopleNames.h"
#include "data/turkey/TurkishPeopleNames.h"
#include "data/ukraine/UkrainianPeopleNames.h"
#include "data/ZodiacSigns.h"
Expand Down Expand Up @@ -61,7 +62,7 @@ const std::map<Country, PeopleNames> countryToPeopleNamesMapping{
{Country::Japan, japanesePeopleNames}, {Country::Portugal, portuguesePeopleNames},
{Country::Hungary, hungarianPeopleNames}, {Country::Croatia, croatianPeopleNames},
{Country::Greece, greekPeopleNames}, {Country::Slovenia, slovenianPeopleNames},
{Country::Austria, austrianPeopleNames},
{Country::Austria, austrianPeopleNames}, {Country::Switzerland, swissPeopleNames},
};

const std::map<Country, std::string> generatedTestName{
Expand All @@ -78,7 +79,7 @@ const std::map<Country, std::string> generatedTestName{
{Country::Japan, "shouldGenerateJapaneseName"}, {Country::Portugal, "shouldGeneratePortugueseName"},
{Country::Hungary, "shouldGenerateHungarianName"}, {Country::Croatia, "shouldGenerateCroatianName"},
{Country::Greece, "shouldGenerateGreekName"}, {Country::Slovenia, "shouldGenerateSlovenianName"},
{Country::Austria, "shouldGenerateAustrianName"},
{Country::Austria, "shouldGenerateAustrianName"}, {Country::Switzerland, "shouldGenerateSwissName"},
};
}

Expand Down
57 changes: 57 additions & 0 deletions src/modules/person/data/switzerland/SwissFirstNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> swissMalesFirstNames = {
"Alfons", "Alfred", "Alois", "André", "Andreas", "Angelo", "Antoine",
"Anton", "Antonio", "Armin", "Arnold", "Arthur", "Beat", "Bernard",
"Bernhard", "Bruno", "Carlo", "Charles", "Christian", "Christoph", "Christophe",
"Claude", "Claudio", "Daniel", "Daniele", "David", "Denis", "Didier",
"Dieter", "Dominik", "Dominique", "Edgar", "Eduard", "Edwin", "Emil",
"Enrico", "Eric", "Erich", "Ernst", "Erwin", "Eugen", "Felix",
"Ferdinand", "Francesco", "Francis", "Franco", "François", "Frank", "Franz",
"Frédéric", "Fredy", "Fridolin", "Friedrich", "Fritz", "Gabriel", "Georg",
"Georges", "Gérald", "Gérard", "Gerhard", "Gianni", "Gilbert", "Giorgio",
"Giovanni", "Giuseppe", "Gottfried", "Guido", "Guy", "Hans", "Hans-Peter",
"Hans-Rudolf", "Hans-Ulrich", "Hansjörg", "Hanspeter", "Hansruedi", "Hansueli", "Harry",
"Heinrich", "Heinz", "Helmut", "Henri", "Herbert", "Hermann", "Hubert",
"Hugo", "Jacques", "Jakob", "Jan", "Jean-Claude", "Jean-Daniel", "Jean-François",
"Jean-Jacques", "Jean-Louis", "Jean-Luc", "Jean-Marc", "Jean-Marie", "Jean-Paul", "Jean-Pierre",
"Johann", "Johannes", "John", "Jörg", "Josef", "Joseph", "Jürg",
"Karl", "Klaus", "Konrad", "Kurt", "Laurent", "Leo", "Louis",
"Luca", "Luigi", "Lukas", "Manfred", "Manuel", "Marc", "Marcel",
"Marco", "Mario", "Markus", "Martin", "Massimo", "Matthias", "Maurice",
"Max", "Michael", "Michel", "Nicolas", "Niklaus", "Norbert", "Olivier",
"Oskar", "Otto", "Paolo", "Pascal", "Patrick", "Paul", "Peter",
"Philipp", "Philippe", "Pierre", "Pierre-Alain", "Pierre-André", "Pius", "Rainer",
"Raymond", "Reinhard", "Remo", "Renato", "Rene", "René", "Reto",
"Richard", "Rudolf", "Ruedi", "Samuel", "Sandro", "Serge", "Silvio",
"Simon", "Stefan", "Stephan", "Stéphane", "Theo", "Theodor", "Thomas",
"Ueli", "Ulrich", "Urs", "Victor", "Viktor", "Walter", "Werner",
"Willi", "Willy", "Wolfgang", "Yves",
};

const std::vector<std::string> swissFemalesFirstNames = {
"Alice", "Andrea", "Angela", "Anita", "Anna", "Anne", "Anne-Marie", "Annemarie",
"Astrid", "Barbara", "Beatrice", "Beatrix", "Bernadette", "Bettina", "Brigitta", "Brigitte",
"Carmen", "Caroline", "Catherine", "Chantal", "Charlotte", "Christa", "Christiane", "Christina",
"Christine", "Claire", "Claudia", "Claudine", "Corinne", "Cornelia", "Daniela", "Danielle",
"Denise", "Dominique", "Dora", "Doris", "Edith", "Eliane", "Elisabeth", "Elsa",
"Elsbeth", "Erica", "Erika", "Esther", "Eva", "Eveline", "Evelyne", "Fabienne",
"Florence", "Françoise", "Franziska", "Gabriela", "Gabrielle", "Gertrud", "Gisela", "Hanna",
"Heidi", "Helen", "Helena", "Helene", "Hildegard", "Ingrid", "Irene", "Iris",
"Isabelle", "Jacqueline", "Janine", "Jean", "Johanna", "Jolanda", "Josette", "Josiane",
"Judith", "Julia", "Karin", "Katharina", "Laura", "Laurence", "Liliane", "Liselotte",
"Lydia", "Madeleine", "Maja", "Manuela", "Margrit", "Margrith", "Maria", "Marianne",
"Marion", "Marlène", "Marlies", "Marlis", "Martha", "Martina", "Martine", "Maya",
"Michele", "Micheline", "Monica", "Monika", "Monique", "Myriam", "Nadia", "Nadja",
"Nathalie", "Nelly", "Nicole", "Paola", "Patricia", "Petra", "Pia", "Priska",
"Regina", "Regula", "Renata", "Renate", "Ruth", "Sabine", "Sandra", "Silvia",
"Simone", "Sonia", "Sonja", "Stéphanie", "Susanna", "Susanne", "Suzanne", "Sylvia",
"Sylvie", "Therese", "Toni", "Ursula", "Verena", "Véronique", "Vreni", "Yolande",
"Yvette", "Yvonne",
};
}
40 changes: 40 additions & 0 deletions src/modules/person/data/switzerland/SwissLastNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> swissLastNames = {
"Ackermann", "Aebi", "Albrecht", "Ammann", "Amrein", "Arnold", "Bachmann",
"Bader", "Bär", "Bättig", "Bauer", "Baumann", "Baumgartner", "Baur",
"Beck", "Benz", "Berger", "Bernasconi", "Betschart", "Bianchi", "Bieri",
"Blaser", "Blum", "Bolliger", "Bosshard", "Braun", "Brun", "Brunner",
"Bucher", "Bühler", "Bühlmann", "Burri", "Christen", "Egger", "Egli",
"Eichenberger", "Erni", "Ernst", "Eugster", "Fankhauser", "Favre", "Fehr",
"Felber", "Felder", "Ferrari", "Fischer", "Flückiger", "Forster", "Frei",
"Frey", "Frick", "Friedli", "Fuchs", "Furrer", "Gasser", "Geiger",
"Gerber", "Gfeller", "Giger", "Gloor", "Graf", "Grob", "Gross",
"Gut", "Haas", "Häfliger", "Hafner", "Hartmann", "Hasler", "Hauser",
"Hermann", "Herzog", "Hess", "Hirt", "Hodel", "Hofer", "Hoffmann",
"Hofmann", "Hofstetter", "Hotz", "Huber", "Hug", "Hunziker", "Hürlimann",
"Imhof", "Isler", "Iten", "Jäggi", "Jenni", "Jost", "Kägi",
"Kaiser", "Kälin", "Käser", "Kaufmann", "Keller", "Kern", "Kessler",
"Knecht", "Koch", "Kohler", "Kuhn", "Küng", "Kunz", "Lang",
"Lanz", "Lehmann", "Leu", "Leunberger", "Lüscher", "Lustenberger", "Lüthi",
"Lutz", "Mäder", "Maier", "Marti", "Martin", "Maurer", "Mayer",
"Meier", "Meili", "Meister", "Merz", "Mettler", "Meyer", "Michel",
"Moser", "Müller", "Näf", "Ott", "Peter", "Pfister", "Portmann",
"Probst", "Rey", "Ritter", "Roos", "Roth", "Rüegg", "Schäfer",
"Schaller", "Schär", "Schärer", "Schaub", "Scheidegger", "Schenk", "Scherrer",
"Schlatter", "Schmid", "Schmidt", "Schneider", "Schnyder", "Schoch", "Schuler",
"Schumacher", "Schürch", "Schwab", "Schwarz", "Schweizer", "Seiler", "Senn",
"Sidler", "Siegrist", "Sigrist", "Spörri", "Stadelmann", "Stalder", "Staub",
"Stauffer", "Steffen", "Steiger", "Steiner", "Steinmann", "Stettler", "Stocker",
"Stöckli", "Stucki", "Studer", "Stutz", "Suter", "Sutter", "Tanner",
"Thommen", "Tobler", "Vogel", "Vogt", "Wagner", "Walder", "Walter",
"Weber", "Wegmann", "Wehrli", "Weibel", "Wenger", "Wettstein", "Widmer",
"Winkler", "Wirth", "Wirz", "Wolf", "Wüthrich", "Wyss", "Zbinden",
"Zehnder", "Ziegler", "Zimmermann", "Zingg", "Zollinger", "Zürcher",
};
}
17 changes: 17 additions & 0 deletions src/modules/person/data/switzerland/SwissPeopleNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "../NameFormats.h"
#include "../PeopleNames.h"
#include "SwissFirstNames.h"
#include "SwissLastNames.h"
#include "SwissPrefixes.h"

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

const PeopleNames swissPeopleNames{{swissMalesFirstNames, {}, swissLastNames, swissMalesPrefixes, {}},
{swissFemalesFirstNames, {}, swissLastNames, swissFemalesPrefixes, {}},
swissPersonNameFormats};

}
11 changes: 11 additions & 0 deletions src/modules/person/data/switzerland/SwissPrefixes.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> swissMalesPrefixes{"Herr", "Dr.", "Prof. Dr."};

const std::vector<std::string> swissFemalesPrefixes{"Frau", "Dr.", "Prof. Dr."};
}

0 comments on commit a5d2012

Please sign in to comment.