LCOV - code coverage report
Current view: top level - unittest/src/utils/common - CommandMock.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 7 7
Test Date: 2024-11-22 15:46:21 Functions: 66.7 % 3 2

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    CommandMock.h
      15              : /// @author  Matthias Heppner
      16              : /// @author  Michael Behrisch
      17              : /// @date    2009-11-30
      18              : ///
      19              : //
      20              : /****************************************************************************/
      21              : 
      22              : #ifndef Command_Mock_h
      23              : #define Command_Mock_h
      24              : 
      25              : #include <utils/common/Command.h>
      26              : 
      27              : // ===========================================================================
      28              : // class definitions
      29              : // ===========================================================================
      30              : /**
      31              :  * @class CommandMock
      32              :  * Mock Implementation for Unit Tests
      33              :  */
      34              : class CommandMock : public Command {
      35              : public:
      36              :     /** @brief Constructor
      37              :      */
      38            1 :     CommandMock() {
      39            1 :         hasRun = false;
      40              :     }
      41              : 
      42              :     /// @brief Destructor
      43            1 :     ~CommandMock() {}
      44              : 
      45              :     /** @brief Executes the command.*/
      46          200 :     SUMOTime execute(SUMOTime currentTime) {
      47          200 :         hasRun = true;
      48          200 :         return currentTime;
      49              :     }
      50              : 
      51              :     /** return true, when execute was called, otherwise false */
      52              :     bool isExecuteCalled() {
      53            2 :         return hasRun;
      54              :     }
      55              : 
      56              : private:
      57              :     bool hasRun;
      58              : 
      59              : };
      60              : 
      61              : 
      62              : #endif
      63              : 
      64              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1