File indexing completed on 2024-06-16 04:47:56
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 #include "skgbankincludes.h" 0013 #include "skgimportexportmanager.h" 0014 0015 /** 0016 * The main function of the unit test 0017 * @param argc the number of arguments 0018 * @param argv the list of arguments 0019 */ 0020 int main(int argc, char** argv) 0021 { 0022 Q_UNUSED(argc) 0023 Q_UNUSED(argv) 0024 0025 // Init test 0026 SKGINITTEST(true) { 0027 // Test import solde initial 0028 SKGDocumentBank document1; 0029 SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true) 0030 SKGError err; 0031 { 0032 // Scope of the transaction 0033 SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_KMY"), err) 0034 SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportkmy5/solde_initial.kmy")); 0035 SKGTESTERROR(QStringLiteral("KMY.importFile"), imp1.importFile(), true) 0036 } 0037 0038 SKGTESTACCOUNT(document1, QStringLiteral("AAA"), 123456.00); 0039 0040 int nboperation = 0; 0041 SKGTESTERROR(QStringLiteral("document1.getNbObjects()"), document1.getNbObjects(QStringLiteral("v_operation_display"), QLatin1String(""), nboperation), true) 0042 SKGTEST(QStringLiteral("document1:nb transactions"), nboperation, 0) 0043 } 0044 0045 { 0046 // Test import steffy 0047 SKGDocumentBank document1; 0048 SKGTESTERROR(QStringLiteral("document1.initialize()"), document1.initialize(), true) 0049 SKGError err; 0050 { 0051 // Scope of the transaction 0052 SKGBEGINTRANSACTION(document1, QStringLiteral("IMPORT_KMY"), err) 0053 SKGImportExportManager imp1(&document1, QUrl::fromLocalFile(SKGTest::getTestPath(QStringLiteral("IN")) % "/skgtestimportkmy5/steffie.kmy")); 0054 SKGTESTERROR(QStringLiteral("KMY.importFile"), imp1.importFile(), true) 0055 } 0056 0057 SKGTESTACCOUNT(document1, QStringLiteral("A000007"), 2695.00); 0058 SKGTESTACCOUNT(document1, QStringLiteral("A000548"), 175494.48); 0059 SKGTESTACCOUNT(document1, QStringLiteral("A000549"), 1186034.71); 0060 SKGTESTACCOUNT(document1, QStringLiteral("A000573"), 30968132.93); 0061 SKGTESTACCOUNT(document1, QStringLiteral("A000584"), 2493455.65); 0062 SKGTESTACCOUNT(document1, QStringLiteral("A000429"), -3723.51); 0063 SKGTESTACCOUNT(document1, QStringLiteral("A000433"), -12809.09); 0064 0065 // Closed accounts 0066 SKGTESTACCOUNT(document1, QStringLiteral("A000004"), 0.0); 0067 SKGTESTACCOUNT(document1, QStringLiteral("A000005"), 0.0); 0068 SKGTESTACCOUNT(document1, QStringLiteral("A000006"), 0.0); 0069 SKGTESTACCOUNT(document1, QStringLiteral("A000490"), 0.0); 0070 SKGTESTACCOUNT(document1, QStringLiteral("A000430"), 0.0); 0071 SKGTESTACCOUNT(document1, QStringLiteral("A000431"), 0.0); 0072 SKGTESTACCOUNT(document1, QStringLiteral("A000432"), 0.0); 0073 SKGTESTACCOUNT(document1, QStringLiteral("A000533"), 0.0); 0074 SKGTESTACCOUNT(document1, QStringLiteral("A000435"), 0.0); 0075 SKGTESTACCOUNT(document1, QStringLiteral("A000436"), 0.0); 0076 SKGTESTACCOUNT(document1, QStringLiteral("A000437"), 0.0); 0077 SKGTESTACCOUNT(document1, QStringLiteral("A000487"), 0.0); 0078 SKGTESTACCOUNT(document1, QStringLiteral("A000492"), 0.0); 0079 SKGTESTACCOUNT(document1, QStringLiteral("A000495"), 0.0); 0080 SKGTESTACCOUNT(document1, QStringLiteral("A000497"), 0.0); 0081 SKGTESTACCOUNT(document1, QStringLiteral("A000499"), 0.0); 0082 SKGTESTACCOUNT(document1, QStringLiteral("A000526"), 0.0); 0083 SKGTESTACCOUNT(document1, QStringLiteral("A000543"), 0.0); 0084 SKGTESTACCOUNT(document1, QStringLiteral("A000553"), 0.0); 0085 SKGTESTACCOUNT(document1, QStringLiteral("A000560"), 0.0); 0086 } 0087 0088 // End test 0089 SKGENDTEST() 0090 }