From 60b3ecf93ad3a8aefd04658d2966763c846f808b Mon Sep 17 00:00:00 2001 From: Hamed Masafi Date: Fri, 8 Feb 2019 12:56:26 +0330 Subject: [PATCH] benchmark test fix --- test/common/post.h | 2 +- test/tst_benckmark/maintest.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/common/post.h b/test/common/post.h index 7759b8c..cca0944 100644 --- a/test/common/post.h +++ b/test/common/post.h @@ -33,7 +33,7 @@ class Post : public Table NUT_DECLARE_CHILD_TABLE(Score, scores) public: - Q_INVOKABLE Post(QObject *parentTableSet = 0); + Q_INVOKABLE Post(QObject *parentTableSet = nullptr); signals: diff --git a/test/tst_benckmark/maintest.cpp b/test/tst_benckmark/maintest.cpp index 5fbee44..a1ef2d3 100644 --- a/test/tst_benckmark/maintest.cpp +++ b/test/tst_benckmark/maintest.cpp @@ -30,7 +30,7 @@ void MainTest::initTestCase() db.setDriver(DRIVER); db.setHostName(HOST); - db.setDatabaseName(DATABASE); + db.setDatabaseName("tst_benchmark_db"); db.setUserName(USERNAME); db.setPassword(PASSWORD); @@ -44,16 +44,16 @@ void MainTest::insert1kPost() QTime t; t.start(); - for (int i = 0; i < 1000; ++i) { + for (int i = 0; i < 100; ++i) { Post *newPost = new Post; newPost->setTitle("post title"); newPost->setSaveDate(QDateTime::currentDateTime()); db.posts()->append(newPost); } + qDebug("1k post inserted in %d ms", t.elapsed()); db.saveChanges(); - qDebug("1k post inserted in %d ms", t.elapsed()); } QTEST_MAIN(MainTest)