Skip to content

Commit

Permalink
Feature/nepali person (#203)
Browse files Browse the repository at this point in the history
* add nepalese people data

* test for nepalese people data
  • Loading branch information
sandeshkhadka authored Oct 11, 2023
1 parent 9fd79f6 commit 3105881
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 8 deletions.
9 changes: 6 additions & 3 deletions include/faker-cxx/types/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ enum class Language
Romanian,
Hindi,
Finnish,
Nepali,
};

inline std::string toString(Language language)
{
std::map<Language, std::string> languageToStringMapping{
{Language::English, "English"} , {Language::Polish, "Polish"}, {Language::Italian, "Italian"},
{Language::French, "French"} , {Language::German, "German"}, {Language::Russian, "Russian"},
{Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}, {Language::Finnish, "Finnish"}};
{Language::English, "English"}, {Language::Polish, "Polish"}, {Language::Italian, "Italian"},
{Language::French, "French"}, {Language::German, "German"}, {Language::Russian, "Russian"},
{Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}, {Language::Finnish, "Finnish"},
{Language::Nepali, "Nepali"},
};

return languageToStringMapping.at(language);
}
Expand Down
5 changes: 5 additions & 0 deletions src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "data/italian/ItalianFirstNamesMales.h"
#include "data/italian/ItalianLastNames.h"
#include "data/JobTitles.h"
#include "data/nepalese/NepaleseFirstNamesFemales.h"
#include "data/nepalese/NepaleseFirstNamesMales.h"
#include "data/nepalese/NepaleseLastNames.h"
#include "data/polish/PolishFirstNamesFemales.h"
#include "data/polish/PolishFirstNamesMales.h"
#include "data/polish/PolishLastNames.h"
Expand Down Expand Up @@ -54,6 +57,7 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirs
{Language::Romanian, {{Sex::Male, romanianFirstNamesMales}, {Sex::Female, romanianFirstNamesFemales}}},
{Language::Hindi, {{Sex::Male, indianFirstNamesMales}, {Sex::Female, indianFirstNamesFemales}}},
{Language::Finnish, {{Sex::Male, finnishFirstNamesMales}, {Sex::Female, finnishFirstNamesFemales}}},
{Language::Nepali, {{Sex::Male, nepaleseFirstNamesMales}, {Sex::Female, nepaleseFirstNamesFemales}}},
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLastNamesMapping{
Expand All @@ -66,6 +70,7 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLast
{Language::Romanian, {{Sex::Male, romanianLastNames}, {Sex::Female, romanianLastNames}}},
{Language::Hindi, {{Sex::Male, indianLastNames}, {Sex::Female, indianLastNames}}},
{Language::Finnish, {{Sex::Male, finnishLastNames}, {Sex::Female, finnishLastNames}}},
{Language::Nepali, {{Sex::Male, nepaleseLastNames}, {Sex::Female, nepaleseLastNames}}},
};
}

Expand Down
16 changes: 11 additions & 5 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include "data/russian/RussianLastNamesFemales.h"
#include "data/russian/RussianLastNamesMales.h"
#include "src/common/StringHelper.h"
#include "src/modules/person/data/nepalese/NepaleseFirstNamesFemales.h"
#include "src/modules/person/data/nepalese/NepaleseFirstNamesMales.h"
#include "src/modules/person/data/nepalese/NepaleseLastNames.h"

using namespace ::testing;
using namespace faker;
Expand All @@ -45,9 +48,10 @@ const auto malePrefix{"Mr."};
const std::vector<std::string> femalePrefixes{"Ms.", "Miss"};
const std::vector<std::string> allPrefixes{"Mr.", "Ms.", "Miss"};

const std::vector<Language> languages{Language::English, Language::French, Language::German,
Language::Italian, Language::Polish, Language::Russian,
Language::Romanian, Language::Hindi, Language::Finnish};
const std::vector<Language> languages{
Language::English, Language::French, Language::German, Language::Italian, Language::Polish,
Language::Russian, Language::Romanian, Language::Hindi, Language::Finnish, Language::Nepali,
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirstNamesMapping{
{Language::English, {{Sex::Male, englishFirstNamesMales}, {Sex::Female, englishFirstNamesFemales}}},
Expand All @@ -59,6 +63,7 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirs
{Language::Romanian, {{Sex::Male, romanianFirstNamesMales}, {Sex::Female, romanianFirstNamesFemales}}},
{Language::Hindi, {{Sex::Male, indianFirstNamesMales}, {Sex::Female, indianFirstNamesFemales}}},
{Language::Finnish, {{Sex::Male, finnishFirstNamesMales}, {Sex::Female, finnishFirstNamesFemales}}},
{Language::Nepali, {{Sex::Male, nepaleseFirstNamesMales}, {Sex::Female, nepaleseFirstNamesFemales}}},
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLastNamesMapping{
Expand All @@ -71,14 +76,15 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLast
{Language::Romanian, {{Sex::Male, romanianLastNames}, {Sex::Female, romanianLastNames}}},
{Language::Hindi, {{Sex::Male, indianLastNames}, {Sex::Female, indianLastNames}}},
{Language::Finnish, {{Sex::Male, finnishLastNames}, {Sex::Female, finnishLastNames}}},
{Language::Nepali, {{Sex::Male, nepaleseLastNames}, {Sex::Female, nepaleseLastNames}}},
};

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::Finnish, "shouldGenerateFinnishName"}, {Language::Nepali, "shouldGenerateNepaleseName"},
};
}

Expand Down Expand Up @@ -325,4 +331,4 @@ TEST_F(PersonTest, shouldGenerateHobby)

ASSERT_TRUE(
std::ranges::any_of(hobbies, [generatedHobby](const std::string& hobby) { return hobby == generatedHobby; }));
}
}
25 changes: 25 additions & 0 deletions src/modules/person/data/nepalese/NepaleseFirstNamesFemales.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> nepaleseFirstNamesFemales = {

"Sita", "Gita", "Shristi", "Anita", "Priya", "Sabina", "Nisha", "Saraswati",
"Asha", "Binita", "Deepa", "Kamala", "Laxmi", "Rina", "Bishnu", "Meera",
"Sushma", "Pooja", "Rajani", "Sunita", "Nirmala", "Rita", "Sumitra", "Usha",
"Manisha", "Rekha", "Sarita", "Kusum", "Puja", "Sanjana", "Smriti", "Pratima",
"Sabita", "Kanchan", "Nandita", "Anjali", "Harsha", "Sangita", "Sushmita", "Suman",
"Sweta", "Sadhana", "Anju", "Nabina", "Bhawana", "Srijana", "Nikita", "Aarati",
"Anita", "Nitu", "Sima", "Sita", "Goma", "Sarala", "Sarika", "Sabita",
"Madhavi", "Indira", "Ankita", "Bhumika", "Neha", "Ashmita", "Subiksha", "Supriya",
"Urmila", "Shova", "Shruti", "Ruby", "Samjhana", "Prakriti", "Ashika", "Reecha",
"Yamuna", "Sunaina", "Sujata", "Muna", "Sulochana", "Jamuna", "Anshu", "Sarala",
"Sarika", "Puspa", "Manju", "Sadhana", "Pabitra", "Usha", "Manita", "Rekha",
"Swastika", "Priyanka", "Sharmila", "Manju", "Sudha", "Laxmi", "Sunita", "Tulsi",
"Usha", "Saraswati", "Rachana"

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

#include <string>
#include <vector>

namespace faker
{

const std::vector<std::string> nepaleseFirstNamesMales = {

"Sijan", "Prabesh", "Niwang", "Nabin", "Sanjok", "Bibek", "Sujal", "Sagar", "Mukunda", "Arun",
"Nirdesh", "Rabin", "Ramesh", "Manoj", "Bimal", "Anil", "Bipin", "Gopal", "Sunil", "Bikash",
"Sujan", "Sudeep", "Nikhil", "Nishant", "Kiran", "Pramod", "Saroj", "Rajesh", "Dilip", "Sandesh",
"Krishna", "Hari", "Suresh", "Arjun", "Bibash", "Rajiv", "Rajendra", "Bijay", "Aashish", "Raju",
"Sabin", "Keshav", "Rabi", "Sanjeev", "Puspa", "Saroj", "Khem", "Shiva", "Mohan", "Dinesh",
"Rajendra", "Suman", "Ujjwal", "Bhuwan", "Birendra", "Birat", "Lalit", "Bhola", "Pradip", "Nabin",
"Suman", "Shankar", "Laxman", "Sushant", "Roshan", "Buddha", "Kapil", "Rajbir", "Suraj", "Raj Kumar",
"Manish", "Ajay", "Dipak", "Anish", "Sabin", "Prem", "Bijay", "Narayan", "Rajat", "Rishi",
"Yogesh", "Rajendra", "Pawan", "Bhawesh", "Pramod", "Pramod", "Saurav", "Hemant", "Subash", "Sparsha",
"Sabin", "Manohar", "Anuj", "Aryan", "Yogendra", "Nischal", "Samir", "Sanjay", "Bijay", "Rohit",
"Rajat", "Biraj", "Kiran", "Pravin", "Pramod"

};

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

#include <string>
#include <vector>

namespace faker
{

const std::vector<std::string> nepaleseLastNames = {
"Adhikari", "Bhattarai", "Gurung", "Tamang", "Magar", "Shrestha", "Rai", "Limbu", "Poudel",
"Joshi", "Karki", "Shah", "Thapa", "Rana", "Regmi", "Acharya", "Basnet", "Shrestha",
"Lama", "Khadka", "Maharjan", "Panta", "Sherpa", "Lohani", "Giri", "Gupta", "Mishra",
"Chhetri", "Magar", "Parajuli", "Dhakal", "Malla", "Gyawali", "Pariyar", "Thakuri", "Roka",
"Sapkota", "Waiba", "Pariyar", "Chand", "Subedi", "Ghimere", "Khatri", "Bista", "Bajracharya",
"Dhungana", "Budhathoki", "Yadav", "Rokaya", "Chaudhary", "Pathak", "Pandey", "Baniya", "Devkota",
"Dangol", "Koirala", "Mishra", "Oli", "Sherchan", "Rajbanshi", "Bhandari", "Niroula", "Nepal",
"Nepali"

};
}

0 comments on commit 3105881

Please sign in to comment.