Skip to content

Commit

Permalink
fix some checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jjimenezshaw committed Nov 11, 2024
1 parent 2b9f006 commit b446fb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions alg/gdal_vectorx_templ.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ template <typename T, std::size_t N> class VectorX

self_type floor() const
{
return apply([](const value_type v) { return std::floor(v); });
return apply([](value_type v) { return std::floor(v); });
}

self_type ceil() const
{
return apply([](const value_type v) { return std::ceil(v); });
return apply([](value_type v) { return std::ceil(v); });
}

/** Compute the scalar product of two vectors */
Expand Down Expand Up @@ -189,7 +189,7 @@ template <typename T, std::size_t N> class VectorX

self_type operator-() const
{
return apply([](const value_type v) { return -v; });
return apply([](value_type v) { return -v; });
}

template <typename U> self_type operator*(U arg) const
Expand Down
8 changes: 5 additions & 3 deletions autotest/cpp/test_gdal_vectorx_templ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

#include "gdal_vectorx_templ.h"

#include <limits>
#include <cmath>
#include <complex>
#include <limits>
#include <type_traits>

#include "gtest_include.h"
Expand Down Expand Up @@ -127,7 +128,8 @@ TEST_F(test_vectorx_templ, fill)

TEST_F(test_vectorx_templ, fill_nan)
{
const auto a = gdal::Vector3d().fill(std::numeric_limits<double>::quiet_NaN());
const auto a =
gdal::Vector3d().fill(std::numeric_limits<double>::quiet_NaN());
EXPECT_EQ(3, a.size());
EXPECT_TRUE(std::isnan(a[0]));
EXPECT_TRUE(std::isnan(a[1]));
Expand All @@ -142,7 +144,6 @@ TEST_F(test_vectorx_templ, change)
p2[1] = 10.5;
EXPECT_EQ(10.5, p2.y());


gdal::Vector3d p3(12.1, 13.6, -9.0);
p3.x() = 79;
EXPECT_EQ(79, p3[0]);
Expand Down Expand Up @@ -191,6 +192,7 @@ TEST_F(test_vectorx_templ, floor)
EXPECT_EQ(2, i.x());
EXPECT_EQ(-4, i.y());
}

TEST_F(test_vectorx_templ, ceil)
{
const gdal::Vector2d a(2.1, -3.6);
Expand Down

0 comments on commit b446fb8

Please sign in to comment.