Giter Site home page Giter Site logo

ramnaresh8 / faker-cxx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cieslarmichal/faker-cxx

0.0 0.0 0.0 6.95 MB

C++ Faker library for generating fake (but realistic) data.

Home Page: https://cieslarmichal.github.io/faker-cxx/

License: MIT License

Shell 0.01% C++ 98.55% CMake 1.42% Dockerfile 0.01%

faker-cxx's Introduction

C++ Faker, a powerful tool for generating realistic and randomized fake data in C++ programming, enhancing data testing and development workflows

Faker C++

Generate fake (but realistic) data for testing and development

clang++ apple clang++ g++ msvc codecov PRs Welcome Chat on Discord

๐ŸŽฏ Goal

The goal of Faker C++ is to provide a library similar to Faker.js for C++ community. Faker C++ helps with the creation of realistic and customizable fake data for testing and development purposes within C++ applications.

Usage and Documentation

To properly use Faker C++ you must first consume the Faker library (see Consuming Library with CMake). Once that is done, you need to include the proper header files depending on the module you wish to generate data from. The module header file names can be found in docs.

Below is an example of how to use Faker C++ in your code.

#include <iostream>

#include "faker-cxx/Date.h"
#include "faker-cxx/Internet.h"
#include "faker-cxx/Location.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();
    const auto city = faker::Location::city();
    const auto streetAddress = faker::Location::streetAddress();

    std::cout << id << std::endl;               // 58018063-ce5a-4fa7-adfd-327eb2e2d9a5
    std::cout << email << std::endl;            // [email protected]
    std::cout << password << std::endl;         // @cWLwgM#Knalxeb
    std::cout << city << std::endl;             // Sayre ville
    std::cout << streetAddress << std::endl;    // 1716 Harriet Alley

    return 0;
}

๐Ÿ’Ž Modules

  • ๐Ÿ›ฉ Airline - aircraft types, airlines, airports, flight numbers
  • ๐Ÿผ Animal - animal types and species
  • ๐Ÿ“– Book - book title, genre, author, publisher, ISBN
  • ๐ŸŽจ Color - color names, rgb, hex, hcl
  • ๐Ÿ›’ Commerce - commerce department, product name, sku, price
  • ๐Ÿข Company - company name, type, industry, catchphrase, buzz phrase
  • ๐Ÿ–ฅ๏ธ Computer - type, manufacturer, model, CPU info, GPU info
  • ๐Ÿ” Crypto - sha256, md5
  • ๐Ÿ’พ Database - column names, column types, database engines
  • โ„น๏ธ Datatype - booleans
  • ๐Ÿ“… Date - past, future dates
  • ๐Ÿฆ Finance - currency, IBAN, BIC, account name, account number, pin, credit card numbers
  • ๐Ÿ Food - food category, vegetables, fruits, meats, dishes
  • ๐Ÿ“ Git - branch names, commit messages, commit hash
  • ๐Ÿ‘จโ€๐Ÿ’ป Hacker - hacker words
  • โœ‹ Helper - random element from container
  • ๐ŸŒ Internet - emails, usernames, passwords, IP, HTTP
  • ๐Ÿ–ผ๏ธ Image - images urls, github avatar urls, image dimensions
  • ๐ŸŒ Location - countries, cities, zip codes, street addresses
  • ๐Ÿ“š Lorem - lorem words, sentences, paragraphs
  • ๐Ÿฅ Medicine - conditions, medical tests, specialties
  • ๐ŸŽฅ Movie - actors, actresses, genres, movie titles
  • ๐ŸŽถ Music - artists, song names, genres
  • ๐Ÿ”ข Number - random integers, floating point numbers
  • ๐Ÿง‘ Person - first, last names, job titles, hobby, genders, sex, nationality, language
  • ๐Ÿ“ž Phone - phone number, IMEI
  • โšฝ Sport - sport names, athletes, events
  • ๐Ÿ”ข String - uuids, alphanumeric, numeric, hexadecimal
  • ๐Ÿ’ป System - file paths, file extensions, file names, directories, semantic version
  • ๐Ÿš— Vehicle - vehicle types, makes, models, fuel types, license plates
  • ๐ŸŽฎ Video game - title, genre, platform, studio
  • ๐ŸŒค๏ธ Weather - temperature, pressure, humidity, weather description
  • ๐Ÿ’ฌ Word - sample words, nouns, verbs

Consuming library with CMake (CMake 3.22 or newer)

  1. Add faker to git submodules (execute in project root):

    mkdir externals && cd externals
    git submodule add https://github.com/cieslarmichal/faker-cxx.git
    git submodule update --init --recursive
    
  2. Link with library:

    set(BUILD_TESTING OFF)
    
    add_subdirectory(externals/faker-cxx)
    
    add_executable(main Main.cpp)
    
    target_link_libraries(main faker-cxx)

Compiler support

Dependencies

  • GTest (set BUILD_TESTING=OFF CMake flag to disable this dependency)
  • fmt (only for compilers that don't support std::format)

In order to use external dependencies installed in your system, you can set the USE_SYSTEM_DEPENDENCIES CMake flag to ON.

Building the library with Conan

The library can be built using Conan package manager to solve external dependencies. To build the library with Conan, follow the steps below:

  1. Install required dependencies:

    conan install conanfile.txt --build=missing
  2. Build the library:

    cmake --preset=conan-release -DUSE_SYSTEM_DEPENDENCIES:BOOL=ON
    cmake --build --preset=conan-release

โœจ Contributing

We would love it if you contributed to Faker C++! ๐Ÿš€

Check our guides on how to build the project locally:

Before contributing please review our CONTRIBUTING guide.

Additionally, we encourage you to join our Discord Channel for contributors.

Examples

This project offers examples to demonstrate how to use the Faker C++ library. These examples can be found in the examples folder of the project repository. The examples showcase various modules of the library and provide code snippets that illustrate how to generate fake data using Faker C++.

License

This project is under MIT license.

faker-cxx's People

Contributors

cieslarmichal avatar uilianries avatar eric-bodhi avatar braw-lee avatar joshhn avatar krupalbhat avatar qmohitsingh avatar plungedincode avatar nithieshm avatar dario-loi avatar mikelkokoshi avatar sandeshkhadka avatar matthope1 avatar globostofo avatar alisedighmoghadam avatar adamjovanovic avatar wkktoria avatar sdorbala avatar yakupcemilk avatar srivastava-yash avatar wsekta avatar sidmalladi avatar sharduld1908 avatar sebastianbacik avatar pe7o avatar shekeraoleksandr avatar kacperwojciechowski avatar mostsignificant avatar goutham-ar avatar sienq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.