Compare commits

..

No commits in common. "73bd6f641ce75b11a430818d127e9e5589fdb8a2" and "b22a830d181ea0ed818a38110e77bfe179970b8a" have entirely different histories.

3 changed files with 21 additions and 12 deletions

View File

@ -113,8 +113,8 @@ class null_observer : public observer<Type> {
public:
template < class OtherType >
explicit null_observer(const null_observer<OtherType> *) {}
void on_attach(const repository_node &, const Type &) const override {}
void on_detach(const repository_node &, const Type &) const override {}
void on_attach(repository_node &, Type &) override {}
void on_detach(repository_node &, Type &) override {}
void on_insert(Type &) override {}
void on_update(Type &) override {}
void on_delete(Type &) override {}

View File

@ -88,11 +88,9 @@ struct pk_field_locator {
desc.kind = pk_kind::uuid;
desc.is_known_at = [](void *obj, const std::size_t off) -> bool {
const auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
// “unknown” = all zeros
for (const auto b: *p) {
if (b != 0) return true;
}
for (auto b: *p) { if (b != 0) return true; }
return false;
};

View File

@ -22,6 +22,23 @@ void validate_author_state(const object_ptr<AuthorType>& ptr, object_state expec
}
}
namespace matador::utils {
template < typename ValueType >
std::ostream& operator<<(std::ostream& os, const result<ValueType, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
std::ostream& operator<<(std::ostream& os, const result<void, error>& value) {
if (value) {
return os;
}
return os << "Error: " << value.err();
}
}
TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relation", "[session][delete][has_many_to_many]") {
auto result = schema.attach<recipe_sequence>("recipes")
.and_then( [this] { return schema.attach<ingredient_sequence>("ingredients"); } )
@ -60,10 +77,4 @@ TEST_CASE_METHOD(SessionFixture, "Test delete object with has many to many relat
const auto ing_result = ses.find<ingredient_sequence>(ingredients[0]->id);
REQUIRE(ing_result.is_ok());
REQUIRE(ing_result.value()->recipes.size() == 2);
auto del_res = ses.remove(recipes[0]);
REQUIRE(del_res);
recipe_result = ses.find<recipe_sequence>(1);
REQUIRE_FALSE(recipe_result);
}