faker-cxx is a modern C++20 open-source library for generating fake data for testing and development.
It has no dependencies beyond Boost library (and GTest for unit tests).
My goal is to create a simple, modern C++ Faker library similar to faker-js/faker.
Lets dive into some simple example of generating fake data for some user
#include <format>
#include <iostream>
#include "faker-cxx/Internet.h"
#include "faker-cxx/String.h"
int main()
{
const auto id = faker::String::uuid();
const auto email = faker::Internet::email();
const auto password = faker::Internet::password();
std::cout << std::format("id: {}, email: {}, password: {}", id, email, password);
return 0;
}
add_subdirectory(third_party/faker-cxx)
add_executable(main main.cpp)
target_link_libraries(main faker-cxx)
- 🌐 Internet - Generate emails, usernames and passwords.
- 🧑 Person - Generate first, last names.
- 🔢 Number - Generate random numbers.
- 📚 Lorem - Generate lorem text.
- 🔢 String - Generate uuids.
- 🌍 Localization - Generate addresses.
- 📅 Date - Generate past, future dates.
- 👕 Commerce - Generate prices, product names, and descriptions.
- 🐘 Animal - Generate animal types and names
- 🎨 Color - Generate RGB colors and color names
- 🏢 Company - Generate company name, location
- ℹ️ Datatype - Generate strings, numbers, booleans
- 🎶 Music - Generate music genre, song names
- 📖 Book - Generate book genre, title, author, isbn, published year
- 📞 Phone - Generate phone number
- 🎮 Game - Generate game genre, title
Please feel free to join Faker C++ development! 🚀