Skip to content

Commit

Permalink
Missed one merge change, as well as removed another unneeded byte_vec…
Browse files Browse the repository at this point in the history
…tor operator
  • Loading branch information
ryan-dozier committed Oct 31, 2024
1 parent 4e8cfa3 commit 6237951
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
2 changes: 0 additions & 2 deletions include/ygm/detail/byte_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class byte_vector {

reference operator*() { return (*m_bv)[i]; }
const reference operator*() const { return (*m_bv)[i]; }
pointer operator->() { return &(*m_bv)[i]; }
const pointer operator->() const { return &(*m_bv)[i]; }
reference operator[](int n) { return (*m_bv)[i + n]; }
const reference operator[](int n) const { return (*m_bv)[i + n]; }

Expand Down
5 changes: 1 addition & 4 deletions include/ygm/detail/comm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
#include <ygm/detail/lambda_compliance.hpp>
#include <ygm/detail/meta/functional.hpp>
#include <ygm/detail/ygm_cereal_archive.hpp>
<<<<<<< HEAD
=======
#include <ygm/version.hpp>

>>>>>>> ygm/v0.7-dev
namespace ygm {

struct comm::mpi_irecv_request {
Expand Down Expand Up @@ -645,7 +642,7 @@ inline void comm::post_new_irecv(std::shared_ptr<ygm::detail::byte_vector> &recv
recv_req.buffer = recv_buffer;

//::madvise(recv_req.buffer.get(), config.irecv_size, MADV_DONTNEED);
ASSERT_MPI(MPI_Irecv(recv_req.buffer.get()->data(), config.irecv_size, MPI_BYTE,
YGM_ASSERT_MPI(MPI_Irecv(recv_req.buffer.get()->data(), config.irecv_size, MPI_BYTE,
MPI_ANY_SOURCE, MPI_ANY_TAG, m_comm_async,
&(recv_req.request)));
m_recv_queue.push_back(recv_req);
Expand Down
39 changes: 19 additions & 20 deletions test/test_byte_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ int main() {
auto bv_it = buffer.begin();
for(const auto& s : vec_sentences) {
for(int i = 0; i < s.size(); i++) {
ASSERT_RELEASE(s[i] == (char)(*bv_it) && s[i] == (*str_it));
ASSERT_RELEASE(s[i] == (char)bv_it->() && s[i] == (*str_it));
YGM_ASSERT_RELEASE(s[i] == (char)(*bv_it) && s[i] == (*str_it));
bv_it++;
str_it++;
}
Expand All @@ -44,33 +43,33 @@ int main() {
auto test_it1 = buffer.begin();
auto test_it2 = buffer.begin();
// Testing logical Operators
ASSERT_RELEASE(test_it1 == test_it2);
ASSERT_RELEASE(test_it1 <= test_it2);
ASSERT_RELEASE(test_it1 >= test_it2);
YGM_ASSERT_RELEASE(test_it1 == test_it2);
YGM_ASSERT_RELEASE(test_it1 <= test_it2);
YGM_ASSERT_RELEASE(test_it1 >= test_it2);
test_it2++;
ASSERT_RELEASE(test_it1 != test_it2);
ASSERT_RELEASE(test_it1 < test_it2);
ASSERT_RELEASE(test_it1 <= test_it2);
ASSERT_RELEASE(test_it2 > test_it1);
ASSERT_RELEASE(test_it2 >= test_it1);
YGM_ASSERT_RELEASE(test_it1 != test_it2);
YGM_ASSERT_RELEASE(test_it1 < test_it2);
YGM_ASSERT_RELEASE(test_it1 <= test_it2);
YGM_ASSERT_RELEASE(test_it2 > test_it1);
YGM_ASSERT_RELEASE(test_it2 >= test_it1);
test_it2--;
ASSERT_RELEASE(test_it1 == test_it2);
YGM_ASSERT_RELEASE(test_it1 == test_it2);
test_it2 += 3; // testing +=
ASSERT_RELEASE(test_it1[3] == test_it2); // testing [] operator
YGM_ASSERT_RELEASE(test_it1[3] == *test_it2); // testing [] operator
test_it2 -= 3; // testing -=
ASSERT_RELEASE(test_it1 == test_it2);
YGM_ASSERT_RELEASE(test_it1 == test_it2);

//testing postfix and prefix operators
ASSERT_RELEASE(test_it1 == test_it2++);
ASSERT_RELEASE(test_it1 == --test_it2);
YGM_ASSERT_RELEASE(test_it1 == test_it2++);
YGM_ASSERT_RELEASE(test_it1 == --test_it2);

ASSERT_RELEASE(!(test_it1 < test_it2++));
ASSERT_RELEASE(!(test_it1 > --test_it2));
YGM_ASSERT_RELEASE(!(test_it1 < test_it2++));
YGM_ASSERT_RELEASE(!(test_it1 > --test_it2));

test_it2++; // test_it1 is at 0, test_it2 is at 1
ASSERT_RELEASE(test_it1 != test_it2--);
ASSERT_RELEASE(test_it1 == test_it2);
ASSERT_RELEASE(test_it1 < ++test_it2);
YGM_ASSERT_RELEASE(test_it1 != test_it2--);
YGM_ASSERT_RELEASE(test_it1 == test_it2);
YGM_ASSERT_RELEASE(test_it1 < ++test_it2);
}

return 0;
Expand Down

0 comments on commit 6237951

Please sign in to comment.