diff --git a/dash/include/dash/GlobRef.h b/dash/include/dash/GlobRef.h index 8a5f0283b..44d5959ad 100644 --- a/dash/include/dash/GlobRef.h +++ b/dash/include/dash/GlobRef.h @@ -114,7 +114,7 @@ class GlobRef explicit constexpr GlobRef(dart_gptr_t dart_gptr) : _gptr(dart_gptr) { } - + /** * Constructor to convert \c GlobAsyncRef to GlobRef. Set to explicit to * avoid unintendet conversion @@ -131,7 +131,7 @@ class GlobRef * of \c operator=(const self_t &). */ GlobRef(const self_t & other) = delete; - + /** * Unlike native reference types, global reference types are moveable. */ @@ -177,18 +177,6 @@ class GlobRef return t; } - template - constexpr bool operator==(const GlobRefT & other) const noexcept - { - return _gptr == other._gptr; - } - - template - constexpr bool operator!=(const GlobRefT & other) const noexcept - { - return !(*this == other); - } - constexpr bool operator==(const_value_type & value) const { return static_cast(*this) == value; @@ -297,30 +285,28 @@ class GlobRef self_t & operator++() { nonconst_value_type val = operator nonconst_value_type(); - ++val; - operator=(val); + operator=(++val); return *this; } nonconst_value_type operator++(int) { nonconst_value_type val = operator nonconst_value_type(); - nonconst_value_type result = val++; + nonconst_value_type res = val++; operator=(val); - return result; + return res; } self_t & operator--() { nonconst_value_type val = operator nonconst_value_type(); - --val; - operator=(val); + operator=(--val); return *this; } nonconst_value_type operator--(int) { nonconst_value_type val = operator nonconst_value_type(); - nonconst_value_type result = val--; + nonconst_value_type res = val--; operator=(val); - return result; + return res; } self_t & operator*=(const_value_type& ref) { @@ -396,7 +382,7 @@ class GlobRef } /** - * specialization which swappes the values of two global references + * specialization which swappes the values of two global references */ inline void swap(dash::GlobRef & b){ T tmp = static_cast(*this); diff --git a/dash/test/container/ArrayTest.cc b/dash/test/container/ArrayTest.cc index dd57f5bc1..fdc6f3b66 100644 --- a/dash/test/container/ArrayTest.cc +++ b/dash/test/container/ArrayTest.cc @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -271,3 +272,19 @@ TEST_F(ArrayTest, MoveSemantics){ ASSERT_EQ_U(*(array_b.lbegin()), 1); } } + + +TEST_F(ArrayTest, ElementCompare){ + using value_t = int; + using array_t = dash::Array; + + if(dash::size() < 2){ + SKIP_TEST(); + } + + array_t arr(dash::size()); + + dash::fill(arr.begin(), arr.end(), 0); + + ASSERT_EQ_U(arr[0], arr[1]); +} diff --git a/dash/test/types/GlobRefTest.cc b/dash/test/types/GlobRefTest.cc index afd7f461b..6574b1529 100644 --- a/dash/test/types/GlobRefTest.cc +++ b/dash/test/types/GlobRefTest.cc @@ -20,38 +20,34 @@ TEST_F(GlobRefTest, ArithmeticOps) ASSERT_EQ_U(gref, 0); // prefix increment - ++gref; + ASSERT_EQ_U(++gref, 1); ASSERT_EQ_U(gref, 1); - ++(++gref); + ASSERT_EQ_U(++(++gref), 3); ASSERT_EQ_U(gref, 3); - // prefix decrement - --(--gref); - ASSERT_EQ_U(gref, 1); + // postfix increment + ASSERT_EQ_U(gref++, 3); + ASSERT_EQ_U(gref, 4); - // unary operations - gref *= 2; - ASSERT_EQ_U(gref, 2); + // postfix decrement + ASSERT_EQ_U(gref--, 4); + ASSERT_EQ_U(gref, 3); - gref /= 2; + // prefix decrement + ASSERT_EQ_U(--(--gref), 1); ASSERT_EQ_U(gref, 1); - gref += 1; + // unary operations + ASSERT_EQ_U(gref *= 2, 2); ASSERT_EQ_U(gref, 2); - gref -= 1; + ASSERT_EQ_U(gref /= 2, 1); ASSERT_EQ_U(gref, 1); - // postfix increment - value_t prev = gref++; - ASSERT_EQ_U(prev, 1); + ASSERT_EQ_U(gref += 1, 2); ASSERT_EQ_U(gref, 2); - - // postfix increment - prev = gref--; - ASSERT_EQ_U(prev, 2); + ASSERT_EQ_U(gref -= 1, 1); ASSERT_EQ_U(gref, 1); - }