Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix apple clang build #202

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/modules/color/ColorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ TEST_F(ColorTest, shouldGenerateHslWithAlpha)
const auto hslValues = faker::StringHelper::split(generatedHslaColor.substr(5, generatedHslaColor.size() - 1), " ");

int hue, staturation, lightness;
double alpha;

std::from_chars(hslValues[0].data(), hslValues[0].data() + hslValues[0].size(), hue);
std::from_chars(hslValues[1].data(), hslValues[1].data() + hslValues[1].size(), staturation);
std::from_chars(hslValues[2].data(), hslValues[2].data() + hslValues[2].size(), lightness);
std::from_chars(hslValues[3].data(), hslValues[3].data() + hslValues[3].size(), alpha);

auto offset = hslValues[3].size();
const auto alpha = std::stod(hslValues[3].data(), &offset);

ASSERT_TRUE(generatedHslaColor.starts_with("hsla("));
ASSERT_TRUE(generatedHslaColor.ends_with(")"));
Expand Down
4 changes: 2 additions & 2 deletions src/modules/commerce/CommerceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ TEST_F(CommerceTest, shouldGeneratePrice)
{
const auto generatedPrice = Commerce::price(100, 10000);

auto priceAsFloat{0.0f};
std::from_chars(generatedPrice.data(), generatedPrice.data() + generatedPrice.size(), priceAsFloat);
auto offset = generatedPrice.size();
const auto priceAsFloat = std::stof(generatedPrice.data(), &offset);

const auto generatedPriceElements = StringHelper::split(generatedPrice, ".");

Expand Down
5 changes: 3 additions & 2 deletions src/modules/finance/FinanceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ TEST_F(FinanceTest, shouldGenerateAccountType)

TEST_F(FinanceTest, shouldGenerateAmount)
{
auto amountAsFloat{0.0f};
const auto generatedAmount = Finance::amount();
std::from_chars(generatedAmount.data(), generatedAmount.data() + generatedAmount.size(), amountAsFloat);

auto offset = generatedAmount.size();
const auto amountAsFloat = std::stof(generatedAmount.data(), &offset);

const auto generatedAmountParts = StringHelper::split(generatedAmount, ".");

Expand Down
16 changes: 8 additions & 8 deletions src/modules/location/LocationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ TEST_F(LocationTest, shouldGenerateLatitude)
{
const auto latitude = Location::latitude();

auto latitudeAsFloat{0.0f};
std::from_chars(latitude.data(), latitude.data() + latitude.size(), latitudeAsFloat);
auto offset = latitude.size();
const auto latitudeAsFloat = std::stof(latitude.data(), &offset);

const auto generatedLatitudeParts = StringHelper::split(latitude, ".");

Expand All @@ -326,8 +326,8 @@ TEST_F(LocationTest, shouldGenerateLatitudeWithSpecifiedPrecision)
{
const auto latitude = Location::latitude(Precision::ThreeDp);

auto latitudeAsFloat{0.0f};
std::from_chars(latitude.data(), latitude.data() + latitude.size(), latitudeAsFloat);
auto offset = latitude.size();
const auto latitudeAsFloat = std::stof(latitude.data(), &offset);

const auto generatedLatitudeParts = StringHelper::split(latitude, ".");

Expand All @@ -341,8 +341,8 @@ TEST_F(LocationTest, shouldGenerateLongitude)
{
const auto longitude = Location::longitude();

auto longitudeAsFloat{0.0f};
std::from_chars(longitude.data(), longitude.data() + longitude.size(), longitudeAsFloat);
auto offset = longitude.size();
const auto longitudeAsFloat = std::stof(longitude.data(), &offset);

const auto generatedLongitudeParts = StringHelper::split(longitude, ".");

Expand All @@ -356,8 +356,8 @@ TEST_F(LocationTest, shouldGenerateLongitudeWithSpecifiedPrecision)
{
const auto longitude = Location::longitude(Precision::SixDp);

auto longitudeAsFloat{0.0f};
std::from_chars(longitude.data(), longitude.data() + longitude.size(), longitudeAsFloat);
auto offset = longitude.size();
const auto longitudeAsFloat = std::stof(longitude.data(), &offset);

const auto generatedLongitudeParts = StringHelper::split(longitude, ".");

Expand Down