File indexing completed on 2024-05-19 16:18:23

0001 /***************************************************************************
0002  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0003  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  ***************************************************************************/
0006 /** @file
0007  * This file is a test script.
0008  *
0009  * @author Stephane MANKOWSKI / Guillaume DE BURE
0010  */
0011 #include "skgtestmacro.h"
0012 
0013 /**
0014  * The main function of the unit test
0015  * @param argc the number of arguments
0016  * @param argv the list of arguments
0017  */
0018 int main(int argc, char** argv)
0019 {
0020     Q_UNUSED(argc)
0021     Q_UNUSED(argv)
0022 
0023     // Init test
0024     SKGINITTEST(true)
0025 
0026     // Test inserts
0027     {
0028         SKGDocument document1;
0029         SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true)
0030         SKGError err;
0031         {
0032             // Scope of the transaction
0033             SKGBEGINTRANSACTION(document1, QStringLiteral("INSERT"), err)
0034 
0035             for (int i = 0; i < 10000; ++i) {
0036                 QString v = QString::number(i);
0037                 SKGTESTERROR(QStringLiteral("PARAM:setParameter"), document1.setParameter(v, v), true)
0038                 SKGTEST(QStringLiteral("PARAM:getParameter"), document1.getParameter(v), v)
0039             }
0040         }
0041     }
0042     // End test
0043     SKGENDTEST()
0044 }