-
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added the animals Took data from faker-js * Added new files to cmakelist * Added Animal methods * Added test to animal module * Added documentation
- Loading branch information
1 parent
f686a36
commit ab482b7
Showing
19 changed files
with
3,959 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace faker | ||
{ | ||
class Animal | ||
{ | ||
public: | ||
/** | ||
* @brief Returns a random species of bear. | ||
* | ||
* @returns Species of bear. | ||
* | ||
* @code | ||
* Animal::bear() // "Polar bear" | ||
* @endcode | ||
*/ | ||
static std::string bear(); | ||
|
||
/** | ||
* @brief Returns a random species of bird. | ||
* | ||
* @returns Species of bird. | ||
* | ||
* @code | ||
* Animal::bird() // "Black-bellied Whistling-Duck" | ||
* @endcode | ||
*/ | ||
static std::string bird(); | ||
|
||
/** | ||
* @brief Returns a random species of cat. | ||
* | ||
* @returns Species of cat. | ||
* | ||
* @code | ||
* Animal::cat() // "Chartreux" | ||
* @endcode | ||
*/ | ||
static std::string cat(); | ||
|
||
/** | ||
* @brief Returns a random species of cetacean. | ||
* | ||
* @returns Species of cetacean. | ||
* | ||
* @code | ||
* Animal::cetacean() // "Blue Whale" | ||
* @endcode | ||
*/ | ||
static std::string cetacean(); | ||
|
||
/** | ||
* @brief Returns a random species of cow. | ||
* | ||
* @returns Species of cow. | ||
* | ||
* @code | ||
* Animal::cow() // "American Angus" | ||
* @endcode | ||
*/ | ||
static std::string cow(); | ||
|
||
/** | ||
* @brief Returns a random species of crocodilia. | ||
* | ||
* @returns Species of crocodilia. | ||
* | ||
* @code | ||
* Animal::crocodilia() // "Dwarf Crocodile" | ||
* @endcode | ||
*/ | ||
static std::string crocodilia(); | ||
|
||
/** | ||
* @brief Returns a random species of dog. | ||
* | ||
* @returns Species of dog. | ||
* | ||
* @code | ||
* Animal::dog() // "Shiba Inu" | ||
* @endcode | ||
*/ | ||
static std::string dog(); | ||
|
||
/** | ||
* @brief Returns a random species of fish. | ||
* | ||
* @returns Species of fish. | ||
* | ||
* @code | ||
* Animal::fish() // "Silver carp" | ||
* @endcode | ||
*/ | ||
static std::string fish(); | ||
|
||
/** | ||
* @brief Returns a random species of horse. | ||
* | ||
* @returns Species of horse. | ||
* | ||
* @code | ||
* Animal::horse() // "Fjord Horse" | ||
* @endcode | ||
*/ | ||
static std::string horse(); | ||
|
||
/** | ||
* @brief Returns a random species of insect. | ||
* | ||
* @returns Species of insect. | ||
* | ||
* @code | ||
* Animal::insect() // "Bee" | ||
* @endcode | ||
*/ | ||
static std::string insect(); | ||
|
||
/** | ||
* @brief Returns a random species of lion. | ||
* | ||
* @returns Species of lion. | ||
* | ||
* @code | ||
* Animal::lion() // "West African Lion" | ||
* @endcode | ||
*/ | ||
static std::string lion(); | ||
|
||
/** | ||
* @brief Returns a random species of rabbit. | ||
* | ||
* @returns Species of rabbit. | ||
* | ||
* @code | ||
* Animal::rabbit() // "Californian" | ||
* @endcode | ||
*/ | ||
static std::string rabbit(); | ||
|
||
/** | ||
* @brief Returns a random species of rodent. | ||
* | ||
* @returns Species of rodent. | ||
* | ||
* @code | ||
* Animal::rodent() // "Chinchilla" | ||
* @endcode | ||
*/ | ||
static std::string rodent(); | ||
|
||
/** | ||
* @brief Returns a random species of snake. | ||
* | ||
* @returns Species of snake. | ||
* | ||
* @code | ||
* Animal::snake() // "Boa constrictor" | ||
* @endcode | ||
*/ | ||
static std::string snake(); | ||
|
||
/** | ||
* @brief Returns a random type of animal. | ||
* | ||
* @returns Type of animal. | ||
* | ||
* @code | ||
* Animal::type() // "dog" | ||
* @endcode | ||
*/ | ||
static std::string type(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include "faker-cxx/Animal.h" | ||
|
||
#include "data/Bears.h" | ||
#include "data/Birds.h" | ||
#include "data/Cats.h" | ||
#include "data/Cetaceans.h" | ||
#include "data/Cows.h" | ||
#include "data/Crocodilia.h" | ||
#include "data/Dogs.h" | ||
#include "data/Fishes.h" | ||
#include "data/Horses.h" | ||
#include "data/Insects.h" | ||
#include "data/Lions.h" | ||
#include "data/Rabbits.h" | ||
#include "data/Rodents.h" | ||
#include "data/Snakes.h" | ||
#include "data/Types.h" | ||
#include "faker-cxx/Helper.h" | ||
|
||
namespace faker | ||
{ | ||
std::string Animal::bear() | ||
{ | ||
return Helper::arrayElement<std::string>(bears); | ||
} | ||
|
||
std::string Animal::bird() | ||
{ | ||
return Helper::arrayElement<std::string>(birds); | ||
} | ||
|
||
std::string Animal::cat() | ||
{ | ||
return Helper::arrayElement<std::string>(cats); | ||
} | ||
|
||
std::string Animal::cetacean() | ||
{ | ||
return Helper::arrayElement<std::string>(cetaceans); | ||
} | ||
|
||
std::string Animal::cow() | ||
{ | ||
return Helper::arrayElement<std::string>(cows); | ||
} | ||
|
||
std::string Animal::crocodilia() | ||
{ | ||
return Helper::arrayElement<std::string>(faker::crocodilia); | ||
} | ||
|
||
std::string Animal::dog() | ||
{ | ||
return Helper::arrayElement<std::string>(dogs); | ||
} | ||
|
||
std::string Animal::fish() | ||
{ | ||
return Helper::arrayElement<std::string>(fishes); | ||
} | ||
|
||
std::string Animal::horse() | ||
{ | ||
return Helper::arrayElement<std::string>(horses); | ||
} | ||
|
||
std::string Animal::insect() | ||
{ | ||
return Helper::arrayElement<std::string>(insects); | ||
} | ||
|
||
std::string Animal::lion() | ||
{ | ||
return Helper::arrayElement<std::string>(lions); | ||
} | ||
|
||
std::string Animal::rabbit() | ||
{ | ||
return Helper::arrayElement<std::string>(rabbits); | ||
} | ||
|
||
std::string Animal::rodent() | ||
{ | ||
return Helper::arrayElement<std::string>(rodents); | ||
} | ||
|
||
std::string Animal::snake() | ||
{ | ||
return Helper::arrayElement<std::string>(snakes); | ||
} | ||
|
||
std::string Animal::type() | ||
{ | ||
return Helper::arrayElement<std::string>(types); | ||
} | ||
} |
Oops, something went wrong.