Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leemaguire committed Jun 26, 2024
1 parent cbef245 commit 1d560aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions include/cpprealm/managed_dictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,35 +235,33 @@ namespace realm {

bool operator==(const V*& rhs) const {
auto a = const_cast<box<V*> *>(this)->m_backing_map.get_object(this->m_key);
auto &b = rhs->m_managed.m_obj;
if (this->m_realm != rhs->m_managed.m_realm) {
return false;
}
return a.get_table() == b.get_table() && a.get_key() == b.get_key();
return a.get_table() == rhs->m_managed.m_obj.get_table() &&
a.get_key() == rhs->m_managed.m_obj.get_key();
}
bool operator!=(const V*& rhs) const {
return !this->operator==(rhs);
}

bool operator==(const managed<V*> &rhs) const {
auto a = const_cast<box<managed<V*>> *>(this)->m_backing_map.get_object(this->m_key);
auto &b = rhs.m_obj;
if (this->m_realm != *rhs.m_realm) {
return false;
}
return a.get_key() == b->get_key();
return a.get_key() == rhs.m_obj->get_key();
}
bool operator!=(const managed<V*> rhs) const {
return !this->operator==(rhs);
}

bool operator==(const managed<V> &rhs) const {
auto a = const_cast<box<managed<V*>> *>(this)->m_backing_map.get_object(this->m_key);
auto &b = rhs.m_obj;
if (this->m_realm != rhs.m_realm) {
return false;
}
return a.get_key() == b.get_key();
return a.get_key() == rhs.m_obj.get_key();
}
bool operator!=(const managed<V> rhs) const {
return !this->operator==(rhs);
Expand Down
1 change: 1 addition & 0 deletions tests/db/map_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TEST_CASE("map", "[map]") {
CHECK(managed_obj.map_uuid_col["a"] == realm::uuid());
CHECK(managed_obj.map_binary_col["a"] == std::vector<uint8_t>{0, 1, 2});
auto managed_link = realm.objects<AllTypesObjectLink>()[0];
CHECK(managed_link.str_col == "foo");
auto res = realm.objects<AllTypesObject>()[0];
CHECK(managed_obj.map_link_col["a"] == managed_link);
CHECK(managed_obj.map_embedded_col["a"] == res.map_embedded_col["a"]);
Expand Down

0 comments on commit 1d560aa

Please sign in to comment.