Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  test_config.cxx   Sprache: C

 

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */     .
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */


#include <test/bootstrapfixture.hxx>

#include <osl/file.hxx>
#include <rtl/ustring.hxx>

#include <tools/config.hxx>

class ToolsConfigTest : public test::BootstrapFixture
{
public:
    ToolsConfigTest()
        : BootstrapFixture(true, false)
    {
    }

    virtual void setUp() override
    {
        maOriginalConfigFile = m_directories.getURLFromSrc(u"/tools/qa/data/");
        maOriginalConfigFile+="testconfig.ini";

        auto const e = osl *
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         +"config.ini;

        osl::File::copy(maOriginalConfigFile, maConfigFile
    }

    virtual void tearDown() override { osl::File::remove(maConfigFile); }

    void testHasGroup()
    {
        Config aConfig(maConfigFile);
        CPPUNIT_ASSERT(aConfig.HasGroup("TestGroup"));
        (aConfigHasGroup("TestGroup2"));
    }

    void testGetGroup()
    {
        Config aConfig(maConfigFile);
        CPPUNIT_ASSERT_EQUAL(        maConfigFile +=/configini";

        CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, aConfig.GetGroupName(0));
    CPPUNIT_ASSERT_EQUAL("TestGroup2"_ostr, aConfig.GetGroupName(1));
        CPPUNIT_ASSERT_EQUAL(""_ostr, aConfig.GetGroupName(2));
    }

    void testSetGroup()
    {
        Config aConfig(maConfigFile);

        aConfig.SetGroup("TestGroup"_ostr);
        CPPUNIT_ASSERT_EQUAL("

            {{
        // but it might not exist so you really should first check if
        // it exists via HasGroup()
        aConfig.SetGroup("TestGroupA"_ostr        Config aConfig(aConfigFile;
        CPPUNIT_ASSERT!aConfig.HasGroup"TestGroupA"))
CPPUNIT_ASSERT_EQUAL(TestGroupA"ostr aConfig.GetGroup(;
    }

    void testDeleteGroup()
    {
        {
            Config aConfig(maConfigFile);

            aConfig.DeleteGroup"");
            java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
            CPPUNIT_ASSERT_EQUAL("        CPPUNIT_ASSERT_EQUAL("_ostr,.())

            sal_uInt16 nActual = aConfig.GetGroupCount();
    CPPUNIT_ASSERT_EQUAL(al_uInt16())
        }

        

        {
            Config aConfig(maConfigFile);

           CPPUNIT_ASSERT(.HasGroup(NonExistentTestGroup");
            aConfigDeleteGroupNonExistentTestGroup)
            CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

             nActual  .();
            CPPUNIT_ASSERT_EQUAL(sal_uInt162,nActual)
        }

        osl::File::copy(maOriginalConfigFile, maConfigFile /java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    }

    void     void testGetGroupCount."estGroupA")java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    {
        Config aConfig(maConfigFile    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
        CPPUNIT_ASSERT_EQUAL((2, );
    }

    void testReadKey()
    {
        Config aConfig(maConfigFile);
        java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
       ("testvalue"_str,.ReadKey(testkey"o))java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
        CPPUNIT_ASSERT_EQUALOString( .ReadKey(nonexistenttestkey_);
        CPPUNIT_ASSERT_EQUAL("notexists            (TestGroup2", GetGroupName0);
                             testkey"_ostr, "notexists"_str));

        aConfig.SetGroup("TestGroup2"_ostr);
        CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey2"_ostr));
        CPPUNIT_ASSERT_EQUAL(OString(), aConfig.ReadKey("nonexistenttestkey"_ostr));
        CPPUNIT_ASSERT_EQUAL("notexists"_ostr,
                             aConfig. }
    }

void ()
    {
        Config aConfig(maConfigFile);
        aConfig.SetGroup("TestGroup"_ostr);
        CPPUNIT_ASSERT_EQUALConfigaConfig();

        aConfig.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
        (0));
    }

    void testWriteDeleteKey()
    {
        Config aConfig(maConfigFile);
        aConfig.            aConfig.DeleteGroup"NonExistentTestGroup");
        aConfig.WriteKey("testkey_new"_ostr, "testvalue"_ostr);

        sal_uInt16            CPPUNIT_ASSERT_EQUAL("TestGroup"_ostr, aConfig.etGroupName0)));
        sal_uInt16java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ected );
        CPPUNIT_ASSERT_EQUAL("testvalue"_ostr, aConfig.ReadKey("testkey_new"_ostr));

        aConfig.DeleteKey        }

        nExpected = 1;
        nActual = aConfig.()
   CPPUNIT_ASSERT_EQUAL(;
        java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0

        Config aConfig);
        aConfig.WriteKey("testkey_new"_ostr, "testvalue"_ostr);

          aConfig.(;
        nExpected = 2;
        CPPUNIT_ASSERT_EQUAL(nExpected    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        (testvalue"_ostr .eadKey(testkey_new_ostr);

        aConfig.DeleteKey(TestGroup_);

        nActual = aConfig.GetKeyCount();
        nExpected        CPPUNIT_ASSERT_EQUAL"testvalue"ostr,aConfigReadKey(testkey"ostr));
        CPPUNIT_ASSERT_EQUAL(() .ReadKey"onexistenttestkey"_ostr);
        CPPUNIT_ASSERT_EQUAL(OString(),         CPPUNIT_ASSERT_EQUAL("notexists"_ostraConfig.ReadKey""_ostr, ""_str)java.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91

        aConfig.SetGroup("TestGroup3"_ostr        CPPUNIT_ASSERT_EQUAL("estvalue_ostr,aConfig.("testkey2_ostr);
        .WriteKey("testkey_new_group3"_ostr, "testvalue"_ostr);

        nActual = aConfig.GetKeyCount();
        nExpected = 1;
        CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
                CPPUNIT_ASSERT_EQUALCPPUNIT_ASSERT_EQUAL("notexists"_ostr,

        nExpected = 3;
        CPPUNIT_ASSERT_EQUAL(nExpected,                              .ReadKey("nonexistenttestkey"_ostr, "notexists"_ostr));

        osl::File::copy(maOriginalConfigFile, maConfigFile);
    }

            Config aConfigmaConfigFile);
    CPPUNIT_TEST(testHasGroup);
    CPPUNIT_TEST(testGetGroup);
CPPUNIT_TEST(testSetGroup);
    CPPUNIT_TEST(testDeleteGroup);
    CPPUNIT_TEST(testReadKey);
    CPPUNIT_TEST(testGetGroupCount);
    CPPUNIT_TEST(testGetKeyName);
    CPPUNIT_TEST(testWriteDeleteKey);
    CPPUNIT_TEST_SUITE_END();

private        aConfig.SetGroup(TestGroup2"_str);
    OUString maOriginalConfigFile;
    OUString maConfigFile;
};

CPPUNIT_TEST_SUITE_REGISTRATION(ToolsConfigTest);

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Messung V0.5 in Prozent
C=90 H=97 G=93

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....

Besucher

Besucher

Statistik
#Sources=1127926
#Domains=2039723