Skip to content
Snippets Groups Projects
Select Git revision
  • 655f2e368466b1bbfbdfcf4d8a80b0c173a8090e
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/releaseTest
  • release/releaseWindowsTest
  • release/windowsReleaseTest
  • release/201910
  • release/qt/201910
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • 1.0.0
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
26 results

databasetester.h

Blame
  • user avatar
    Nicolas Jager authored and Sébastien Blin committed
    add functions to get the number of unread messages. Clients get the
    number of unread messages in a conversation when getting
    ConversationInfo.
    
    additional test coming with : testCount, count the number of
    occurrences in the database matching a value.
    
    Change-Id: Ie7db0b7f288bfe82b64518dd1e9790837c2a2087
    Reviewed-by: default avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
    655f2e36
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    databasetester.h 2.52 KiB
    /*
     *  Copyright (C) 2017 Savoir-faire Linux Inc.
     *
     *  Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
     *
     *  This program is free software; you can redistribute it and/or modify
     *  it under the terms of the GNU General Public License as published by
     *  the Free Software Foundation; either version 3 of the License, or
     *  (at your option) any later version.
     *
     *  This program is distributed in the hope that it will be useful,
     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *  GNU General Public License for more details.
     *
     *  You should have received a copy of the GNU General Public License
     *  along with this program; if not, write to the Free Software
     *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
     */
    
    #pragma once
    
    // cppunit
    #include <cppunit/TestFixture.h>
    #include <cppunit/extensions/HelperMacros.h>
    
    // std
    #include <memory>
    
    // lrc
    #include "database.h"
    
    namespace lrc
    {
    namespace test
    {
    
    class DatabaseTester : public CppUnit::TestFixture {
    
        CPPUNIT_TEST_SUITE(DatabaseTester);
        CPPUNIT_TEST(testInsertAndSelectCorrectValue);
        CPPUNIT_TEST(testCountUnreadMessages);
        CPPUNIT_TEST(testInsertIncorrectFail);
        CPPUNIT_TEST(testSelectInexistantValue);
        CPPUNIT_TEST(testUpdateCorrectValue);
        CPPUNIT_TEST(testUpdateInexistantValue);
        CPPUNIT_TEST(testDeleteCorrectValue);
        CPPUNIT_TEST(testDeleteInexistantValue);
        CPPUNIT_TEST_SUITE_END();
    
    public:
        /**
         * Method automatically called before each test by CppUnit
         */
        void setUp();
        /**
         * Method automatically called after each test CppUnit
         */
        void tearDown();
        /**
         * Insert a correct value and try to retrieve it
         */
        void testInsertAndSelectCorrectValue();
        /**
         * Insert incorrect value
         */
        void testInsertIncorrectFail();
        /**
         * Select inexistant value
         */
        void testSelectInexistantValue();
        /**
         * Update value
         */
        void testUpdateCorrectValue();
        /**
         * Update inexistant value
         */
        void testUpdateInexistantValue();
        /**
         * Delete value from the database
         */
        void testDeleteCorrectValue();
        /**
         * Delete inexistant value in the database
         */
        void testDeleteInexistantValue();
        /**
         * Count the number of unread messages.
         */
        void testCountUnreadMessages();
    
    protected:
        std::unique_ptr<lrc::Database> database_;
        std::string dbPath_;
    };
    
    } // namespace test
    } // namespace lrc