Skip to content

Commit

Permalink
Add person first and last names data from India #120 (#170)
Browse files Browse the repository at this point in the history
* Changes with fake Indian Names data and UT's added

* Undo Formatting Changes

* Added Indian Language Hindi
  • Loading branch information
sharduld1908 authored Oct 1, 2023
1 parent 4425277 commit d018d67
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 33 deletions.
7 changes: 4 additions & 3 deletions include/faker-cxx/types/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ enum class Language
German,
Russian,
Romanian,
Hindi,
};

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::English, "English"} , {Language::Polish, "Polish"}, {Language::Italian, "Italian"},
{Language::French, "French"} , {Language::German, "German"}, {Language::Russian, "Russian"},
{Language::Romanian, "Romanian"}, {Language::Hindi, "Hindi"}};

return languageToStringMapping.at(language);
}
Expand Down
52 changes: 28 additions & 24 deletions src/modules/person/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "data/german/GermanFirstNamesFemales.h"
#include "data/german/GermanFirstNamesMales.h"
#include "data/german/GermanLastNames.h"
#include "data/indian/IndianFirstNames.h"
#include "data/indian/IndianLastNames.h"
#include "data/italian/ItalianFirstNamesFemales.h"
#include "data/italian/ItalianFirstNamesMales.h"
#include "data/italian/ItalianLastNames.h"
Expand All @@ -33,30 +35,32 @@ namespace faker
{
namespace
{
const std::string malePrefix{"Mr."};
const std::vector<std::string> femalePrefixes{"Ms.", "Miss"};
const std::vector<std::string> allPrefixes{"Mr.", "Ms.", "Miss"};
const std::vector<std::string> sexes{"Male", "Female"};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirstNamesMapping{
{Language::English, {{Sex::Male, englishFirstNamesMales}, {Sex::Female, englishFirstNamesFemales}}},
{Language::French, {{Sex::Male, frenchFirstNamesMales}, {Sex::Female, frenchFirstNamesFemales}}},
{Language::German, {{Sex::Male, germanFirstNamesMales}, {Sex::Female, germanFirstNamesFemales}}},
{Language::Italian, {{Sex::Male, italianFirstNamesMales}, {Sex::Female, italianFirstNamesFemales}}},
{Language::Polish, {{Sex::Male, polishFirstNamesMales}, {Sex::Female, polishFirstNamesFemales}}},
{Language::Russian, {{Sex::Male, russianFirstNamesMales}, {Sex::Female, russianFirstNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianFirstNamesMales}, {Sex::Female, romanianFirstNamesFemales}}},
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLastNamesMapping{
{Language::English, {{Sex::Male, englishLastNames}, {Sex::Female, englishLastNames}}},
{Language::French, {{Sex::Male, frenchLastNames}, {Sex::Female, frenchLastNames}}},
{Language::German, {{Sex::Male, germanLastNames}, {Sex::Female, germanLastNames}}},
{Language::Italian, {{Sex::Male, italianLastNames}, {Sex::Female, italianLastNames}}},
{Language::Polish, {{Sex::Male, polishLastNames}, {Sex::Female, polishLastNames}}},
{Language::Russian, {{Sex::Male, russianLastNamesMales}, {Sex::Female, russianLastNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianLastNames}, {Sex::Female, romanianLastNames}}},
};
const std::string malePrefix{"Mr."};
const std::vector<std::string> femalePrefixes{"Ms.", "Miss"};
const std::vector<std::string> allPrefixes{"Mr.", "Ms.", "Miss"};
const std::vector<std::string> sexes{"Male", "Female"};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirstNamesMapping{
{Language::English, {{Sex::Male, englishFirstNamesMales}, {Sex::Female, englishFirstNamesFemales}}},
{Language::French, {{Sex::Male, frenchFirstNamesMales}, {Sex::Female, frenchFirstNamesFemales}}},
{Language::German, {{Sex::Male, germanFirstNamesMales}, {Sex::Female, germanFirstNamesFemales}}},
{Language::Italian, {{Sex::Male, italianFirstNamesMales}, {Sex::Female, italianFirstNamesFemales}}},
{Language::Polish, {{Sex::Male, polishFirstNamesMales}, {Sex::Female, polishFirstNamesFemales}}},
{Language::Russian, {{Sex::Male, russianFirstNamesMales}, {Sex::Female, russianFirstNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianFirstNamesMales}, {Sex::Female, romanianFirstNamesFemales}}},
{Language::Hindi, {{Sex::Male, indianFirstNamesMales}, {Sex::Female, indianFirstNamesFemales}}},
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLastNamesMapping{
{Language::English, {{Sex::Male, englishLastNames}, {Sex::Female, englishLastNames}}},
{Language::French, {{Sex::Male, frenchLastNames}, {Sex::Female, frenchLastNames}}},
{Language::German, {{Sex::Male, germanLastNames}, {Sex::Female, germanLastNames}}},
{Language::Italian, {{Sex::Male, italianLastNames}, {Sex::Female, italianLastNames}}},
{Language::Polish, {{Sex::Male, polishLastNames}, {Sex::Female, polishLastNames}}},
{Language::Russian, {{Sex::Male, russianLastNamesMales}, {Sex::Female, russianLastNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianLastNames}, {Sex::Female, romanianLastNames}}},
{Language::Hindi, {{Sex::Male, indianLastNames}, {Sex::Female, indianLastNames}}}
};
}

std::string Person::firstName(Language language, std::optional<Sex> sex)
Expand Down
15 changes: 9 additions & 6 deletions src/modules/person/PersonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "data/russian/RussianFirstNamesMales.h"
#include "data/russian/RussianLastNamesFemales.h"
#include "data/russian/RussianLastNamesMales.h"
#include "data/indian/IndianFirstNames.h"
#include "data/indian/IndianLastNames.h"
#include "src/common/StringHelper.h"

using namespace ::testing;
Expand All @@ -40,7 +42,7 @@ 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::Polish, Language::Russian, Language::Romanian, Language::Hindi};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirstNamesMapping{
{Language::English, {{Sex::Male, englishFirstNamesMales}, {Sex::Female, englishFirstNamesFemales}}},
Expand All @@ -50,6 +52,7 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToFirs
{Language::Polish, {{Sex::Male, polishFirstNamesMales}, {Sex::Female, polishFirstNamesFemales}}},
{Language::Russian, {{Sex::Male, russianFirstNamesMales}, {Sex::Female, russianFirstNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianFirstNamesMales}, {Sex::Female, romanianFirstNamesFemales}}},
{Language::Hindi, {{Sex::Male, indianFirstNamesMales}, {Sex::Female, indianFirstNamesFemales}}},
};

const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLastNamesMapping{
Expand All @@ -60,13 +63,13 @@ const std::map<Language, std::map<Sex, std::vector<std::string>>> languageToLast
{Language::Polish, {{Sex::Male, polishLastNames}, {Sex::Female, polishLastNames}}},
{Language::Russian, {{Sex::Male, russianLastNamesMales}, {Sex::Female, russianLastNamesFemales}}},
{Language::Romanian, {{Sex::Male, romanianLastNames}, {Sex::Female, romanianLastNames}}},
};
{Language::Hindi, {{Sex::Male, indianLastNames}, {Sex::Female, indianLastNames}}}};

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::English, "shouldGenerateEnglishName"}, {Language::French, "shouldGenerateFrenchName"},
{Language::German, "shouldGenerateGermanName"}, {Language::Italian, "shouldGenerateItalianName"},
{Language::Polish, "shouldGeneratePolishName"}, {Language::Russian, "shouldGenerateRussianName"},
{Language::Romanian, "shouldGenerateRomanianName"}, {Language::Hindi, "shouldGenerateIndianName"}};
}

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

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> indianFirstNamesMales = {
"Aadi", "Aadil", "Aahan", "Aarav", "Aarit", "Aarush", "Aaryan", "Aaryav",
"Aayush", "Abeer", "Abhay", "Abhinav", "Abhishek", "Abhiyay", "Adarsh", "Adhvait",
"Aditya", "Advait", "Advay", "Ahaan", "Akash", "Akhil", "Akhilesh", "Akshant",
"Akshat", "Akshay", "Akshaya", "Alok", "Aman", "Amar", "Amardeep", "Amit",
"Amitabh", "Anand", "Aniket", "Anirudh", "Anish", "Ankit", "Ankur", "Ansh",
"Anshul", "Anshuman", "Anupam", "Anurag", "Arin", "Arjun", "Armaan", "Arnav",
"Arpit", "Arun", "Arush", "Arvind", "Arya", "Aryaman", "Aryan", "Aryana",
"Aryaveer", "Ashutosh", "Atharv", "Atul", "Avinash", "Avir", "Ayush", "Baldev",
"Bhavesh", "Bhavya", "Bhushan", "Bhuvan", "Bimal", "Birju", "Brij", "Brijesh",
"Brijmohan", "Chirag", "Darsh", "Darshan", "Deep", "Deepak", "Deepesh", "Dev",
"Devang", "Devansh", "Devendra", "Devesh", "Dhairik", "Dhairya", "Dhaval", "Dheeraj",
"Dhiraj", "Dhriti", "Dhruv", "Dhruva", "Dhruvansh", "Dinesh", "Dipak", "Dipesh",
"Divyansh", "Eshan", "Gagan", "Ganesh", "Gaurav", "Gautam", "Girish", "Gopal",
"Govind", "Harish", "Harsh", "Harshad", "Harshal", "Hemant", "Himanshu", "Hitesh",
"Hridaan", "Hriday", "Hrithik", "Hrithvik", "Hrushi", "Iqbal", "Ishaan", "Ishan",
"Ishant", "Ishwar", "Jagat", "Jagdish", "Jai", "Jatin", "Jatish", "Jay",
"Jayant", "Jitender", "Jitendra", "Kabir", "Kabira", "Kabiraj", "Kailash", "Kairav",
"Kamal", "Kamlesh", "Kapil", "Karan", "Karna", "Karthik", "Karun", "Kashyap",
"Kavish", "Keshav", "Ketan", "Kian", "Kiran", "Kishan", "Kishore", "Krish",
"Krishna", "Krishnaiah", "Kunal", "Kushal", "Lakshay", "Lakshit", "Lalit", "Laxman",
"Lokesh", "Manav", "Manik", "Maninder", "Manish", "Manoj", "Mayank", "Mayur",
"Mohan", "Mohit", "Mukesh", "Mukul", "Mukund", "Nakul", "Nandan", "Nandlal",
"Narayan", "Naveen", "Neeraj", "Nihal", "Nikhil", "Nilesh", "Nimish", "Nirav",
"Nishant", "Nishith", "Nitesh", "Nitin", "Nitish", "Om", "Omkar", "Pankaj",
"Pariket", "Parikshit", "Parth", "Partha", "Parthiv", "Parv", "Parveen", "Pradeep",
"Pramod", "Pranav", "Pranay", "Pranit", "Pranjal", "Pratham", "Pratyush", "Pravin",
"Prayag", "Prithvi", "Raahat", "Raghav", "Rahul", "Rajat", "Rajendra", "Rajesh",
"Rajiv", "Rajkishor", "Rajkumar", "Rajnish", "Rajveer", "Rakshan", "Raman", "Ramesh",
"Ranbir", "Ranjan", "Ranveer", "Rapul", "Ravi", "Revansh", "Reyansh", "Rian",
"Ridhaan", "Rishabh", "Rishi", "Rishit", "Ritesh", "Ritish", "Ritvik", "Rohan",
"Rohant", "Rohit", "Rudransh", "Rupesh", "Rushabh", "Rushil", "Saarthak", "Sachin",
"Sagar", "Sahil", "Sahitya", "Sameer", "Sameet", "Sanjay", "Sanjeev", "Sanket",
"Sarthak", "Sarvesh", "Satish", "Shantanu", "Shardul", "Shashank", "Shaurya", "Shivam",
"Shivansh", "Shlok", "Shourya", "Shresht", "Shubham", "Shyam", "Siddharth", "Subhash",
"Sudhir", "Sumeet", "Sumit", "Sunil", "Sunny", "Suraj", "Surender", "Suresh",
"Surya", "Sushant", "Suvan", "Tanay", "Tanish", "Tanmay", "Tanush", "Tanvik",
"Taran", "Tarun", "Tavish", "Tejas", "Tejus", "Tushar", "Uday", "Umesh",
"Utkarsh", "Vaibhav", "Vansh", "Vanshaj", "Varun", "Ved", "Vedant", "Veer",
"Veerendra", "Vibhav", "Vicky", "Vidit", "Vidyut", "Vihaan", "Vihan", "Vijay",
"Vikas", "Vikram", "Vikrant", "Vimal", "Vinay", "Vinayak", "Vineet", "Vinod",
"Vipul", "Virat", "Virendra", "Viresh", "Vishal", "Vishesh", "Vishnu", "Vishwas",
"Vivaan", "Vivan", "Vivek", "Viyan", "Yaman", "Yash", "Yashas", "Yashith",
"Yashraj", "Yashwant", "Yashwanta", "Yashwardhan", "Yogesh", "Yug", "Yuva", "Yuvan",
"Yuvansh", "Yuvraj", "Yuvraja", "Zaheer", "Zahir", "Zain", "Zayyan",
};

const std::vector<std::string> indianFirstNamesFemales = {
"Aadrika", "Aadya", "Aakriti", "Aanya", "Aanyaya", "Aaradhya", "Aarohi", "Aashi", "Aashika",
"Adhithi", "Aditi", "Aisha", "Akshara", "Alia", "Amaira", "Amara", "Ananya", "Anika",
"Anisha", "Anushka", "Anvi", "Anwaya", "Aria", "Arunima", "Avani", "Avishi", "Avni",
"Banita", "Bhavana", "Bhavisha", "Bhavna", "Bhavya", "Bhavyata", "Bhumi", "Bhumika", "Bhuvitha",
"Chakori", "Chandika", "Chandna", "Chandni", "Chandrika", "Charmika", "Charu", "Charul", "Charvi",
"Chhavi", "Chitra", "Deepika", "Devanshi", "Devika", "Dhanya", "Dhriti", "Disha", "Divisha",
"Divishi", "Divya", "Diya", "Drishti", "Dyuthi", "Eeshaal", "EeshaaniEk", "Esha", "Eshitha",
"Falguni", "Falini", "Faria", "Farida", "Freesha", "Fulki", "Gargee", "Gargi", "Garima",
"Gauri", "Giribala", "Gitali", "Gitanjali", "Grishma", "Harini", "Haritha", "Harshini", "Harshita",
"Himani", "Hina", "Hiral", "Hrishita", "Inaya", "Ira", "Isha", "Ishana", "Ishani",
"Ishika", "Ishiqa", "Ishira", "Ishita", "Ishitha", "Ishmita", "Janvi", "Janya", "Jara",
"Jaswita", "Jia", "Jivana", "Jivika", "Jivisha", "Jiya", "Jyotsna", "Kanya", "Kashvi",
"Kashvii", "Kavya", "Khushi", "Kia", "Kiara", "Kiran", "Kirti", "Kritika", "Kshirja",
"Lasya", "Lavanya", "Lavisha", "Lavitha", "Leah", "Lisha", "Manasvi", "Manika", "Manisha",
"Mannat", "Manvi", "Manvita", "Meenal", "Meera", "Megha", "Mira", "Myra", "Mysha",
"Naina", "Nandita", "Natasha", "Neha", "Nidhi", "Nidhita", "Niharika", "Nishi", "Nitya",
"Nityari", "Nityasha", "Nityashi", "Nyra", "Oishi", "Ojal", "Ojaswi", "Oshin", "Oviya",
"Pankhudi", "Pankhuri", "Pari", "Parinidhi", "Parul", "Pihu", "Praniti", "Pranjal", "Prisha",
"Prishita", "Priyanka", "Qirat", "Queenie", "Quinara", "Quisha", "Rashi", "Rasika", "Rhea",
"Riddhi", "Rishi", "Ritara", "Rithika", "Riya", "Roshni", "Rupali", "Saanvi", "Saesha",
"Saisha", "Sanika", "Sanvi", "Sanya", "Sara", "Saraswati", "Sarita", "Savita", "Shanaya",
"Simran", "Sita", "Siya", "Sneha", "Sonam", "Tamanna", "Tanishi", "Tanvi", "Tishira",
"Tithira", "Trisha", "Ujjwala", "Urisha", "Urvashi", "Urvi", "Utkarsha", "Vaishnavi", "Vanshika",
"Vanya", "Vasundhara", "Vidhi", "Vidulika", "Vinita", "Wansika", "Wisha", "Wynona", "Xandra",
"Xara", "Yashi", "Yashika", "Yashvi", "Yukta", "Yukthi", "Zaina", "Zaira", "Zara",
"Zarika", "Zarna", "Zoya"};
}
36 changes: 36 additions & 0 deletions src/modules/person/data/indian/IndianLastNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once

#include <string>
#include <vector>

namespace faker
{
const std::vector<std::string> indianLastNames = {
"Acharya", "Agarwal", "Aggarwal", "Ahluwalia", "Ahuja", "Amin", "Anand",
"Arora", "Arvind", "Babu", "Bajaj", "Bajwa", "Banerjee", "Bansal",
"Batra", "Bhagat", "Bhardwaj", "Bhargava", "Bhasin", "Bhat", "Bhatia",
"Bhatnagar", "Bhatt", "Bhattacharya", "Biswas", "Bose", "Chabra", "Chadha",
"Chakrabarti", "Chakrabarty", "Chakraborty", "Chakravarti", "Chandra", "Chatterjee", "Chaturvedi",
"Chauhan", "Chawla", "Chopra", "Choudhary", "Choudhury", "Das", "Deshmukh",
"Deshpande", "Dewan", "Dey", "Dhawan", "Dhillon", "Dixit", "Dube",
"Dutt", "Dutta", "Easwaran", "Edwin", "Ekbote", "Eswaran", "Fadnavis",
"Fernandes", "Gandhi", "Ghosh", "Ghoshal", "Gill", "Gokhale", "Goswami",
"Gupta", "Harikrishnan", "Hegde", "Inamdar", "Iyengar", "Iyer", "Jaiswal",
"Jha", "Joglekar", "Joshi", "Juneja", "Kadam", "Kakkar", "Kamble",
"Kapoor", "Kashyap", "Kaur", "Khan", "Khanna", "Khera", "Khosla",
"Khurana", "Kohli", "Kulkarni", "Kumar", "Lal", "Lalwani", "Luthra",
"Mahajan", "Majumdar", "Malhotra", "Malik", "Mandal", "Mathur", "Mazumdar",
"Mehra", "Mehrotra", "Mehta", "Menon", "Mishra", "Mittal", "Mukherjee",
"Mukhopadhyay", "Mundra", "Nag", "Nagpal", "Nair", "Nambiar", "Nanda",
"Narang", "Narula", "Nayar", "Negi", "Oberoi", "Ojha", "Oza",
"Padmanabhan", "Pandey", "Pandit", "Patil", "Pawar", "Pillai", "Pradhan",
"Prakash", "Puri", "Qazi", "Qureshi", "Raghavan", "Raghunathan", "Rai",
"Raj", "Rajput", "Rana", "Rao", "Rastogi", "Rathore", "Reddy",
"Sabharwal", "Sardar", "Sarin", "Saxena", "Sen", "Sengupta", "Seth",
"Sethi", "Shah", "Sharma", "Shukla", "Singh", "Singhal", "Sinha",
"Soni", "Sood", "Suri", "Talreja", "Talwar", "Thakkar", "Thakur",
"Tiwari", "Trivedi", "Tyagi", "Upadhyay", "Upadhyaya", "Uppal", "Vaid",
"Vaidya", "Varghese", "Varma", "Verma", "Vij", "Vora", "Vyas",
"Wadhwa", "Wagh", "Waghmare", "Wagle", "Walia", "Xavier", "Yadav",
"Zakaria", "Zaveri"};
}

0 comments on commit d018d67

Please sign in to comment.