C++ Faker is a modern C++20 open-source library for generating fake data for testing and development.
The library is heavily inspired by Faker.js.
Dependencies: GTest for building library tests (can be disabled by setting CMake flag BUILD_TESTS=OFF)
My goal is to provide a library like Faker.js for C++ developers.
Lets dive into some simple example of generating fake data
#include <format>
#include <iostream>
#include "faker-cxx/Internet.h"
#include "faker-cxx/String.h"
#include "faker-cxx/Date.h"
int main()
{
const auto id = faker::String::uuid();
const auto email = faker::Internet::email();
const auto password = faker::Internet::password();
const auto createdAt = faker::Date::pastDate();
const auto updatedAt = faker::Date::recentDate();
std::cout << std::format("id: {}, email: {}, password: {}, createdAt: {}, updatedAt: {}", id, email, password,
createdAt, updatedAt);
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, job titles, genders, sex.
- 🛒 Commerce - Generate commerce department, product name, sku, price.
- 📅 Date - Generate past, future dates.
- 🏦 Finance - Generate currency, IBAN, BIC, account name, account number, pin.
- 🏢 Company - Generate company name.
- 🔢 Number - Generate random integers, floating point numbers.
- 🎨 Color - Generate color names, rgb, hex.
- ℹ️ Datatype - Generate booleans.
- 📚 Lorem - Generate lorem text.
- 🔢 String - Generate uuids, alphanumeric, numberic, hexadecimal.
Feel free to join Faker C++ development! 🚀
Please check CONTRIBUTING guide.
Discord Channel for contributors.