LCOV - code coverage report
Current view: top level - include/testutils/hardio/impl - mock_pin_access.h (source / functions) Hit Total Coverage
Test: hardiocore_coverage Lines: 6 6 100.0 %
Date: 2025-05-26 19:00:29 Functions: 6 12 50.0 %

          Line data    Source code
       1             : /*      File: mock_pin_access.h
       2             :  *       This file is part of the program hardiocore
       3             :  *       Program description : Abstract low level I/O removing direct hardware
       4             :  * implementation Copyright (C) 2018-2020 -  Robin Passama (CNRS / LIRMM)
       5             :  * Clement Rebut (EPITA / LIRMM) Charles Villard (EPITA / LIRMM). All Right
       6             :  * reserved.
       7             :  *
       8             :  *       This software is free software: you can redistribute it and/or modify
       9             :  *       it under the terms of the CeCILL-C license as published by
      10             :  *       the CEA CNRS INRIA, either version 1
      11             :  *       of the License, or (at your option) any later version.
      12             :  *       This software is distributed in the hope that it will be useful,
      13             :  *       but WITHOUT ANY WARRANTY without even the implied warranty of
      14             :  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      15             :  *       CeCILL-C License for more details.
      16             :  *
      17             :  *       You should have received a copy of the CeCILL-C License
      18             :  *       along with this software. If not, it can be found on the official
      19             :  * website of the CeCILL licenses family (http://www.cecill.info/index.en.html).
      20             :  */
      21             : /**
      22             :  * @file impl/mock_pin_access.h
      23             :  * @author Robin Passama
      24             :  * @brief header file for MockPin related classes.
      25             :  * @date May 2025
      26             :  * @ingroup  testutils
      27             :  */
      28             : #pragma once
      29             : 
      30             : #include <hardio/core.h>
      31             : #include <hardio/test/mock_pin_endpoint.h>
      32             : 
      33             : namespace hardio {
      34             : 
      35             : namespace test {
      36             : 
      37             : class MockPinAnalogRead : public PinAnalogRead,
      38             :                           private MockPinEndPointAccessor {
      39             : public:
      40             :     MockPinAnalogRead();
      41             : 
      42          12 :     virtual ~MockPinAnalogRead() = default;
      43             : 
      44             :     int analog_read() const final;
      45             : 
      46             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
      47             : 
      48             :     using MockPinEndPointAccessor::endpoint;
      49             : };
      50             : 
      51             : class MockPinAnalogWrite : public PinAnalogWrite,
      52             :                            private MockPinEndPointAccessor {
      53             : public:
      54             :     MockPinAnalogWrite();
      55             : 
      56          12 :     virtual ~MockPinAnalogWrite() = default;
      57             : 
      58             :     void analog_write(int value) final;
      59             : 
      60             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
      61             :     using MockPinEndPointAccessor::endpoint;
      62             : };
      63             : 
      64             : class MockPinDigitalRead : public PinDigitalRead,
      65             :                            private MockPinEndPointAccessor {
      66             : public:
      67             :     MockPinDigitalRead();
      68             : 
      69          10 :     virtual ~MockPinDigitalRead() = default;
      70             : 
      71             :     bool digital_read() const final;
      72             : 
      73             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
      74             :     using MockPinEndPointAccessor::endpoint;
      75             : };
      76             : 
      77             : class MockPinDigitalWrite : public PinDigitalWrite,
      78             :                             private MockPinEndPointAccessor {
      79             : public:
      80             :     MockPinDigitalWrite();
      81             : 
      82          10 :     virtual ~MockPinDigitalWrite() = default;
      83             : 
      84             :     void digital_write(bool high) final;
      85             : 
      86             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
      87             :     using MockPinEndPointAccessor::endpoint;
      88             : };
      89             : 
      90             : class MockPinPWMWrite : public PinPWMWrite, private MockPinEndPointAccessor {
      91             : public:
      92             :     MockPinPWMWrite();
      93             : 
      94          11 :     virtual ~MockPinPWMWrite() = default;
      95             : 
      96             :     void set_duty_cycle(float percentage) final;
      97             : 
      98             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
      99             :     using MockPinEndPointAccessor::endpoint;
     100             : };
     101             : 
     102             : class MockPinPPMWrite : public PinPPMWrite, private MockPinEndPointAccessor {
     103             : public:
     104             :     MockPinPPMWrite();
     105             : 
     106          11 :     virtual ~MockPinPPMWrite() = default;
     107             : 
     108             :     void set_pulse(const std::chrono::microseconds& value) final;
     109             : 
     110             :     bool custom_initialization(std::string& reason, bool managed_thread) final;
     111             :     using MockPinEndPointAccessor::endpoint;
     112             : };
     113             : 
     114             : } // namespace test
     115             : } // namespace hardio

Generated by: LCOV version 1.16