Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 22b97d74

Von Christian Ehringfeld vor etwa 9 Jahren hinzugefügt

  • ID 22b97d744708b3fcfd0c9d83f58a85a99010b1e9
  • Vorgänger d8f2b16b
  • Nachfolger 4af3f83d

test cases

Unterschiede anzeigen:

src/querybuilder.cpp
QHash<QString, Relation> m = (entity->getInheritanceStrategy() ==
InheritanceStrategy::PER_CLASS_TABLE ? entity->getRelations() :
EntityHelper::getNonInheritedRelations(entity.data()));
//QHash<QString, Relation> m = entity->getRelations();
auto props = EntityHelper::getMetaProperties(entity.data());
for (auto i = m.begin(); i != m.end(); ++i) {
Relation r = i.value();
src/schema/sqliteschema.cpp
this->typeMap->insert(TYPE_BIGPK,
"integer PRIMARY KEY AUTOINCREMENT NOT NULL");
this->typeMap->insert(TYPE_BOOLEAN, "boolean");
this->typeMap->insert(TYPE_SMALLINT, "smallint");
this->typeMap->insert(TYPE_SMALLINT, "integer");
this->typeMap->insert(TYPE_INTEGER, "integer");
this->typeMap->insert(TYPE_BIGINT, "bigint");
this->typeMap->insert(TYPE_BIGINT, "integer");
this->typeMap->insert(TYPE_FLOAT, "float");
this->typeMap->insert(TYPE_DOUBLE, "double");
this->typeMap->insert(TYPE_FLOAT, "real");
tests/em/tst_em.cpp
QCOMPARE(columns.size(), 3);
this->containsColumn(columns, "id", QVariant::Int, tblName, true);
this->containsColumn(columns, "version", QVariant::String);
this->containsColumn(columns, "applyTime");
this->containsColumn(columns, "applyTime", QVariant::String);
}
}
......
this->containsColumn(columns, "firstName", QVariant::String);
this->containsColumn(columns, "familyName", QVariant::String);
this->containsColumn(columns, "customPictureFileName", QVariant::String);
this->containsColumn(columns, "birthday");
this->containsColumn(columns, "birthday", QVariant::String);
this->containsColumn(columns, "nickName", QVariant::String);
this->containsColumn(columns, "gender", QVariant::Int);
}
......
QCOMPARE(columns.size(), 3);
this->containsColumn(columns, "id", QVariant::Int, "group", true);
this->containsColumn(columns, "name", QVariant::String);
this->containsColumn(columns, "leader_id");
this->containsColumn(columns, "leader_id", QVariant::Int);
}
bool containsPersonGroups = tables.contains("person_groups");
QVERIFY(containsPersonGroups);
......
auto columns = schema->getColumns();
QCOMPARE(columns.size(), 3);
this->containsColumn(columns, "id", QVariant::Int, "person_groups", true);
this->containsColumn(columns, "person_id");
this->containsColumn(columns, "group_id");
this->containsColumn(columns, "person_id", QVariant::Int);
this->containsColumn(columns, "group_id", QVariant::Int);
}
QVERIFY(!tables.contains("group_persons"));
}
......
QVERIFY(containsColumn);
if(containsColumn) {
auto column = columns.value(name);
qDebug() << name << column->type() << type;
if(type != QVariant::UserType) {
QCOMPARE(column->type(), type);
}
......
void Em::testRelationTableCreation() {
this->createRelationTables();
auto tables = this->e->getSchema()->getTables();
/**
* @todo test columns
*/
QVERIFY(tables.contains("workergroup"));
QVERIFY(tables.contains("employee"));
bool containsEmployee = tables.contains("employee");
QVERIFY(containsEmployee);
if(containsEmployee) {
auto schema = tables.value("employee");
auto columns = schema->getColumns();
QCOMPARE(columns.size(), 4);
this->containsColumn(columns, "id", QVariant::Int, "employee", true);
this->containsColumn(columns, "persNumber", QVariant::String);
this->containsColumn(columns, "manager", QVariant::Int);
this->containsColumn(columns, "department", QVariant::String);
}
QVERIFY(tables.contains("workergroup_workers"));
QVERIFY(!tables.contains("group_employee"));
QVERIFY(!tables.contains("employee_workergroups"));
......
g->setPersons({e1, e2});
auto entityGroup = g.objectCast<Entity>();
QVERIFY(this->e->create(entityGroup));
g->setName("Taskforce 0008");
QVERIFY(this->e->merge(entityGroup));
QVERIFY(this->e->remove(entityGroup));
} catch(QString e) {
QFAIL(e.toUtf8().constData());
}

Auch abrufbar als: Unified diff