diff --git a/test/test_span.cpp b/test/test_span.cpp index a6f45644..c27cb76d 100644 --- a/test/test_span.cpp +++ b/test/test_span.cpp @@ -1,7 +1,7 @@ -#include "ports-of-call/span.hpp" #include "ports-of-call/portability.hpp" -#include +#include "ports-of-call/span.hpp" #include +#include // ======================================================================================== // © (or copyright) 2019-2024. Triad National Security, LLC. All rights @@ -564,19 +564,17 @@ TEST_CASE("span portability", "[PortsOfCall::span]") { constexpr const std::size_t Nb = N * sizeof(Real); constexpr const Real tol = 1.0E-8; - constexpr const Real pi = std::acos(-1); + constexpr const Real pi = 3.141592653589793238462643383279502884; constexpr Real d_gp = 2. * pi / static_cast(N); std::vector h_gp(N); - for(auto i = 0; i < N; ++i) - { + for (auto i = 0; i < N; ++i) { h_gp[i] = -pi + static_cast(i) * d_gp; } + Real *p_a = (Real *)PORTABLE_MALLOC(Nb); - Real *p_a = (Real*) PORTABLE_MALLOC(Nb); - // device span, host span span d_s(p_a, N); span h_s(h_gp); @@ -586,11 +584,13 @@ TEST_CASE("span portability", "[PortsOfCall::span]") { // integrate cos x dx over [-pi,pi] Real res_sum{0.0}; - portableReduce( "integrate", 0, N, PORTABLE_LAMBDA(const int i, Real& rsum){ rsum += (std::cos(d_s[i])*d_gp) ;}, res_sum); + portableReduce( + "integrate", 0, N, + PORTABLE_LAMBDA(const int i, Real &rsum) { rsum += (std::cos(d_s[i]) * d_gp); }, + res_sum); // require sum < tol - REQUIRE(std::abs(res_sum) < tol); - + REQUIRE(std::abs(res_sum) < tol); PORTABLE_FREE(p_a); }