benchmark test fix

This commit is contained in:
Hamed Masafi 2019-02-08 12:56:26 +03:30
parent 6f31c4e6b9
commit 60b3ecf93a
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ class Post : public Table
NUT_DECLARE_CHILD_TABLE(Score, scores) NUT_DECLARE_CHILD_TABLE(Score, scores)
public: public:
Q_INVOKABLE Post(QObject *parentTableSet = 0); Q_INVOKABLE Post(QObject *parentTableSet = nullptr);
signals: signals:

View File

@ -30,7 +30,7 @@ void MainTest::initTestCase()
db.setDriver(DRIVER); db.setDriver(DRIVER);
db.setHostName(HOST); db.setHostName(HOST);
db.setDatabaseName(DATABASE); db.setDatabaseName("tst_benchmark_db");
db.setUserName(USERNAME); db.setUserName(USERNAME);
db.setPassword(PASSWORD); db.setPassword(PASSWORD);
@ -44,16 +44,16 @@ void MainTest::insert1kPost()
QTime t; QTime t;
t.start(); t.start();
for (int i = 0; i < 1000; ++i) { for (int i = 0; i < 100; ++i) {
Post *newPost = new Post; Post *newPost = new Post;
newPost->setTitle("post title"); newPost->setTitle("post title");
newPost->setSaveDate(QDateTime::currentDateTime()); newPost->setSaveDate(QDateTime::currentDateTime());
db.posts()->append(newPost); db.posts()->append(newPost);
} }
qDebug("1k post inserted in %d ms", t.elapsed());
db.saveChanges(); db.saveChanges();
qDebug("1k post inserted in %d ms", t.elapsed());
} }
QTEST_MAIN(MainTest) QTEST_MAIN(MainTest)