Skip to content

Commit

Permalink
reformat code (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
cieslarmichal authored Nov 10, 2023
1 parent d103f0a commit c528d37
Show file tree
Hide file tree
Showing 25 changed files with 4,130 additions and 4,071 deletions.
11 changes: 7 additions & 4 deletions include/faker-cxx/Airline.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#include <string>
#include <vector>

namespace faker {
class Airline {
namespace faker
{
class Airline
{
public:
enum class AircraftType
{
Expand Down Expand Up @@ -116,7 +118,8 @@ class Airline {
*/
static std::string flightNumber(bool addLeadingZeros = false, unsigned int length = 4);

struct Range {
struct Range
{
unsigned int min;
unsigned int max;
};
Expand All @@ -137,4 +140,4 @@ class Airline {
*/
static std::string flightNumber(bool addLeadingZeros = false, Range length = {1, 4});
};
}
}
9 changes: 6 additions & 3 deletions include/faker-cxx/Git.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Git
*
* @param dateYears The range of years the date may be in the past. Defaults to `15`.
* @param shaLength The length of output SHA hash. Defaults to `40`.
* @param language The language set for name generating. Defaults to `English` (could be random, if there was a random language generator).
* @param language The language set for name generating. Defaults to `English` (could be random, if there was a
random language generator).
* @returns Commit entry.
*
* @code
Expand All @@ -50,7 +51,9 @@ class Git
spawn polyp"
* @endcode
*/
static std::string commitEntry(std::optional<unsigned> dateYears = std::nullopt, std::optional<unsigned> shaLength = std::nullopt, Language language = Language::English);
static std::string commitEntry(std::optional<unsigned> dateYears = std::nullopt,
std::optional<unsigned> shaLength = std::nullopt,
Language language = Language::English);

/**
* @brief Generates a random commit message.
Expand All @@ -76,4 +79,4 @@ class Git
*/
static std::string commitSha(unsigned length = 40);
};
}
}
130 changes: 66 additions & 64 deletions include/faker-cxx/Hacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,75 @@

#include <string>

namespace faker {
class Hacker {
namespace faker
{
class Hacker
{
public:
/**
* @brief Returns a hacker abbreviation.
*
* @returns abbreviation.
*
* @code
* Hacker::abbreviation() // "TCP"
* @endcode
*/
static std::string abbreviation();
/**
* @brief Returns a hacker abbreviation.
*
* @returns abbreviation.
*
* @code
* Hacker::abbreviation() // "TCP"
* @endcode
*/
static std::string abbreviation();

/**
* @brief Returns a random adjective.
*
* @returns adjective.
*
* @code
* Hacker::adjective() // "open-source"
* @endcode
*/
static std::string adjective();
/**
* @brief Returns a random adjective.
*
* @returns adjective.
*
* @code
* Hacker::adjective() // "open-source"
* @endcode
*/
static std::string adjective();

/**
* @brief Returns a random noun.
*
* @returns noun.
*
* @code
* Hacker::noun() // "coder"
* @endcode
*/
static std::string noun();
/**
* @brief Returns a random noun.
*
* @returns noun.
*
* @code
* Hacker::noun() // "coder"
* @endcode
*/
static std::string noun();

/**
* @brief Returns a random verb.
*
* @returns verb.
*
* @code
* Hacker::verb() // "run"
* @endcode
*/
static std::string verb();
/**
* @brief Returns a random verb.
*
* @returns verb.
*
* @code
* Hacker::verb() // "run"
* @endcode
*/
static std::string verb();

/**
* @brief Returns a random ingverb.
*
* @returns ingverb.
*
* @code
* Hacker::ingverb() // "backing up"
* @endcode
*/
static std::string ingverb();
/**
* @brief Returns a random ingverb.
*
* @returns ingverb.
*
* @code
* Hacker::ingverb() // "backing up"
* @endcode
*/
static std::string ingverb();

/**
* @brief Returns a random phrase.
*
* @return phrase.
*
* @code
* Hacker::phrase() // "If we bypass the monitor, we can get to the TCP monitor through the neural EXE monitor!"
* @endcode
*/
static std::string phrase();
};
}
/**
* @brief Returns a random phrase.
*
* @return phrase.
*
* @code
* Hacker::phrase() // "If we bypass the monitor, we can get to the TCP monitor through the neural EXE monitor!"
* @endcode
*/
static std::string phrase();
};
}
16 changes: 10 additions & 6 deletions include/faker-cxx/Weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace faker
class Weather
{
public:
struct Temperature {
struct Temperature
{
double metric, imperial;
};

Expand All @@ -23,7 +24,8 @@ class Weather

static Temperature temperature();

struct Pressure {
struct Pressure
{
double metric;
double imperial;
};
Expand All @@ -39,7 +41,8 @@ class Weather
*/
static Pressure pressure();

struct Visibility {
struct Visibility
{
double metric;
double imperial;
};
Expand All @@ -55,7 +58,8 @@ class Weather
*/
static Visibility visibility();

struct WindSpeed {
struct WindSpeed
{
double metric;
double imperial;
};
Expand Down Expand Up @@ -113,6 +117,6 @@ class Weather
* Weather::cloudCover(); // 10
* @endcode
*/
static int cloudCover();
static int cloudCover();
};
}
}
56 changes: 28 additions & 28 deletions src/common/WeatherHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,42 @@ class WeatherHelper
{
public:
/**
* @brief Converts celsius to fahrenheit
*
* @param celsius
*
* @return double
*
* @code
* WeatherHelper::celsiusToFahrenheit(10); // 50
* @endcode
* @brief Converts celsius to fahrenheit
*
* @param celsius
*
* @return double
*
* @code
* WeatherHelper::celsiusToFahrenheit(10); // 50
* @endcode
*/
static double celsiusToFahrenheit(double celsius);

/**
* @brief Converts kPa to PSI
*
* @param kPa
*
* @return double
*
* @code
* WeatherHelper::kPaToPsi(1000); // 145.037
* @endcode
* @brief Converts kPa to PSI
*
* @param kPa
*
* @return double
*
* @code
* WeatherHelper::kPaToPsi(1000); // 145.037
* @endcode
*/
static double kPaToPsi(double kPa);

/**
* @brief Converts miles to kilometers
*
* @param miles
*
* @return double
*
* @code
* WeatherHelper::milesToKilometers(10); // 16.0934
* @endcode
* @brief Converts miles to kilometers
*
* @param miles
*
* @return double
*
* @code
* WeatherHelper::milesToKilometers(10); // 16.0934
* @endcode
*/
static double milesToKilometers(double miles);
};
}
}
13 changes: 9 additions & 4 deletions src/common/WeatherHelperTest.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
#include "WeatherHelper.h"

#include "gtest/gtest.h"

using namespace faker;
using namespace ::testing;

class WeatherHelperTest : public Test {
class WeatherHelperTest : public Test
{
public:
};

TEST_F(WeatherHelperTest, shouldConvertCelsiusToFahrenheit) {
TEST_F(WeatherHelperTest, shouldConvertCelsiusToFahrenheit)
{
double celsius = 10.0;
double fahrenheit = WeatherHelper::celsiusToFahrenheit(celsius);

ASSERT_EQ(fahrenheit, 50.0);
}

TEST_F(WeatherHelperTest, shouldConvertKPaToPsi) {
TEST_F(WeatherHelperTest, shouldConvertKPaToPsi)
{
double kPa = 100.0;
double psi = WeatherHelper::kPaToPsi(kPa);

ASSERT_EQ(psi, 14.503773773375);
}

TEST_F(WeatherHelperTest, shouldConvertMilesToKilometers) {
TEST_F(WeatherHelperTest, shouldConvertMilesToKilometers)
{
double miles = 10.0;
double kilometers = WeatherHelper::milesToKilometers(miles);

Expand Down
Loading

0 comments on commit c528d37

Please sign in to comment.