Skip to content
Snippets Groups Projects
Verified Commit 2a82e68d authored by René Fritze's avatar René Fritze
Browse files

[clang_format] fixup

parent 4d3c2512
No related branches found
No related tags found
No related merge requests found
...@@ -80,13 +80,15 @@ void print_collected_eoc_study_results(const std::map<std::string, std::vector<d ...@@ -80,13 +80,15 @@ void print_collected_eoc_study_results(const std::map<std::string, std::vector<d
unsigned int grid_elements(); unsigned int grid_elements();
template <typename T> template <typename T>
static typename std::enable_if<Common::is_vector<T>::value, T>::type init_bound(typename Common::VectorAbstraction<T>::S val) static typename std::enable_if<Common::is_vector<T>::value, T>::type
init_bound(typename Common::VectorAbstraction<T>::S val)
{ {
const auto size = Common::VectorAbstraction<T>::has_static_size ? Common::VectorAbstraction<T>::static_size : 3u; const auto size = Common::VectorAbstraction<T>::has_static_size ? Common::VectorAbstraction<T>::static_size : 3u;
return Common::VectorAbstraction<T>::create(size, val); return Common::VectorAbstraction<T>::create(size, val);
} }
template <typename T> template <typename T>
static typename std::enable_if<!Common::is_vector<T>::value, T>::type init_bound(typename Common::VectorAbstraction<T>::S val) static typename std::enable_if<!Common::is_vector<T>::value, T>::type
init_bound(typename Common::VectorAbstraction<T>::S val)
{ {
return T(val); return T(val);
} }
......
...@@ -23,19 +23,22 @@ struct ScopeTest : public testing::Test ...@@ -23,19 +23,22 @@ struct ScopeTest : public testing::Test
typedef int T; typedef int T;
static constexpr T constant = 1; static constexpr T constant = 1;
template <class P> template <class P>
void deref(P& p) { void deref(P& p)
{
EXPECT_NE(p, nullptr); EXPECT_NE(p, nullptr);
auto g = *p; auto g = *p;
EXPECT_EQ(constant, g); EXPECT_EQ(constant, g);
} }
template <template <class F> class Provider, class P> template <template <class F> class Provider, class P>
void scope(P& p) { void scope(P& p)
{
Provider<T> shared_provider(p); Provider<T> shared_provider(p);
deref(p); deref(p);
} }
void check_shared() { void check_shared()
{
auto shared = std::make_shared<T>(constant); auto shared = std::make_shared<T>(constant);
scope<ConstStorageProvider>(shared); scope<ConstStorageProvider>(shared);
deref(shared); deref(shared);
......
...@@ -27,20 +27,20 @@ TEST(Init, Random) ...@@ -27,20 +27,20 @@ TEST(Init, Random)
{ {
typedef RNG_FIELD_TYPE T; typedef RNG_FIELD_TYPE T;
typedef DefaultRNG<T> RNG; typedef DefaultRNG<T> RNG;
// typedef typename VectorAbstraction<T>::S Scalar; // typedef typename VectorAbstraction<T>::S Scalar;
const auto lower_bound = init_bound<T>(1); const auto lower_bound = init_bound<T>(1);
// for the int check we need at least on int in between lower and upper bound // for the int check we need at least on int in between lower and upper bound
const auto upper_bound = init_bound<T>(3); const auto upper_bound = init_bound<T>(3);
const auto seed = init_bound<T>(0); const auto seed = init_bound<T>(0);
RNG rng1; RNG rng1;
RNG rng2(lower_bound); RNG rng2(lower_bound);
RNG rng3(lower_bound, upper_bound); RNG rng3(lower_bound, upper_bound);
RNG rng4(lower_bound, upper_bound, seed); RNG rng4(lower_bound, upper_bound, seed);
for(auto& r : std::array<RNG, 3>{{rng2, rng3, rng4}}) { for (auto& r : std::array<RNG, 3>{{rng2, rng3, rng4}}) {
const auto val = r(); const auto val = r();
EXPECT_TRUE(FloatCmp::ge(val, lower_bound)); EXPECT_TRUE(FloatCmp::ge(val, lower_bound));
} }
for(auto& r : std::array<RNG, 2>{{rng3, rng4}}) { for (auto& r : std::array<RNG, 2>{{rng3, rng4}}) {
const auto val = r(); const auto val = r();
EXPECT_TRUE(FloatCmp::le(val, upper_bound)); EXPECT_TRUE(FloatCmp::le(val, upper_bound));
} }
...@@ -55,4 +55,3 @@ TEST(Init, Random) ...@@ -55,4 +55,3 @@ TEST(Init, Random)
std::string rstr = str_rng(); std::string rstr = str_rng();
EXPECT_EQ(rstr.size(), 2); EXPECT_EQ(rstr.size(), 2);
} }
...@@ -48,7 +48,7 @@ struct ValidationTest : public testing::Test ...@@ -48,7 +48,7 @@ struct ValidationTest : public testing::Test
{ {
typedef VectorAbstraction<T>::S S; typedef VectorAbstraction<T>::S S;
const auto scalar_eps = Epsilon<S>::value; const auto scalar_eps = Epsilon<S>::value;
const T lower = init_bound<T>(std::numeric_limits<S>::min() + scalar_eps); const T lower = init_bound<T>(std::numeric_limits<S>::min() + scalar_eps);
const T upper = init_bound<T>(std::numeric_limits<S>::max() - scalar_eps); const T upper = init_bound<T>(std::numeric_limits<S>::max() - scalar_eps);
RNGType rng(lower, upper); RNGType rng(lower, upper);
for (int i = samples; i > 0; --i) { for (int i = samples; i > 0; --i) {
......
...@@ -124,8 +124,7 @@ public: ...@@ -124,8 +124,7 @@ public:
std::string msg(const T& value) const std::string msg(const T& value) const
{ {
return (boost::format("given value %s was invalid: not less than %s") % to_string(value) % to_string(lhs_)) return (boost::format("given value %s was invalid: not less than %s") % to_string(value) % to_string(lhs_)).str();
.str();
} }
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment