Compare commits
2 Commits
b22a830d18
...
73bd6f641c
| Author | SHA1 | Date |
|---|---|---|
|
|
73bd6f641c | |
|
|
98d58d8e60 |
|
|
@ -113,8 +113,8 @@ class null_observer : public observer<Type> {
|
|||
public:
|
||||
template < class OtherType >
|
||||
explicit null_observer(const null_observer<OtherType> *) {}
|
||||
void on_attach(repository_node &, Type &) override {}
|
||||
void on_detach(repository_node &, Type &) override {}
|
||||
void on_attach(const repository_node &, const Type &) const override {}
|
||||
void on_detach(const repository_node &, const Type &) const override {}
|
||||
void on_insert(Type &) override {}
|
||||
void on_update(Type &) override {}
|
||||
void on_delete(Type &) override {}
|
||||
|
|
|
|||
|
|
@ -88,9 +88,11 @@ struct pk_field_locator {
|
|||
desc.kind = pk_kind::uuid;
|
||||
|
||||
desc.is_known_at = [](void *obj, const std::size_t off) -> bool {
|
||||
auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
|
||||
const auto *p = reinterpret_cast<uuid16 *>(static_cast<std::uint8_t *>(obj) + off);
|
||||
// “unknown” = all zeros
|
||||
for (auto b: *p) { if (b != 0) return true; }
|
||||
for (const auto b: *p) {
|
||||
if (b != 0) return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -22,23 +22,6 @@ 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"); } )
|
||||
|
|
@ -77,4 +60,10 @@ 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue