query/test/core/object/ObjectTest.cpp

20 lines
628 B
C++

#include <catch2/catch_test_macros.hpp>
#include "matador/object/object.hpp"
#include "matador/object/repository.hpp"
#include "../test/models/author.hpp"
#include "../test/models/book.hpp"
TEST_CASE("Generate object from type", "[object][generate]") {
using namespace matador;
object::repository repo;
auto result = repo.attach<test::author>("authors");
REQUIRE(result);
const auto obj = object::object::generate<test::book>(repo, "books");
REQUIRE(obj->name() == "books");
REQUIRE(obj->alias().empty());
REQUIRE(obj->attributes().size() == 4);
REQUIRE(obj->constraints().size() == 2);
}