From 02d6ac514c81827ebfdf5c65d614efeae55fd57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Thu, 19 Feb 2026 18:17:15 +0100 Subject: [PATCH] added checks for lazy relation --- test/backends/SessionTest.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/backends/SessionTest.cpp b/test/backends/SessionTest.cpp index b4e3e3a..2152acd 100644 --- a/test/backends/SessionTest.cpp +++ b/test/backends/SessionTest.cpp @@ -166,8 +166,6 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects", "[session][f } TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-many lazy relation", "[session][find][one-to-many][eager]") { - // auto result = schema.attach("authors") - // .and_then( [this] { return schema.attach("books"); } ) auto result = schema.attach("books") .and_then( [this] { return schema.attach("authors"); } ) .and_then([this] { return schema.create(db); } ); @@ -175,8 +173,8 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma schema.initialize_executor(ses); std::vector authors { - object_ptr{std::make_shared(1, "Michael", "Crichton", "23.10.1942", 1975, true)}, - object_ptr{std::make_shared( 2, "Steven", "King", "21.9.1947", 1956, false)} + make_object(1, "Michael", "Crichton", "23.10.1942", 1975, true), + make_object( 2, "Steven", "King", "21.9.1947", 1956, false) }; for (const auto &a: authors) { @@ -189,8 +187,8 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma auto all_authors = find_result.release(); std::vector> author_repo; for (auto it = all_authors.begin(); it != all_authors.end(); ++it) { - std::cout << "author: " << it->first_name << " (books: " << it->books.size() << ")\n"; - author_repo.emplace_back(it.optr()); + REQUIRE(it->books.size() == 0); + author_repo.emplace_back(it.optr()); } REQUIRE(author_repo.size() == 2); @@ -217,7 +215,7 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma all_authors = find_result.release(); for (auto it = all_authors.begin(); it != all_authors.end(); ++it) { - std::cout << "author: " << it->first_name << " (books: " << it->books.size() << ")\n"; + REQUIRE(it->books.size() == 5); } }