GCC Code Coverage Report


Directory: ./
File: src/PClockMockFile.h
Date: 2026-01-26 14:45:44
Exec Total Coverage
Lines: 6 6 100.0%
Functions: 2 2 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #ifndef __PCLOCKMOCKFILE_H__
8 #define __PCLOCKMOCKFILE_H__
9
10 #include "PClockMock.h"
11 #include "ellapsedTime.h"
12
13 ///@brief Mock of a clock
14 class PClockMockFile{
15 public:
16 PClockMockFile();
17 virtual ~PClockMockFile();
18
19 //clock API
20 time_t now();
21 void sleep(EllapsedTime ellapsedTime) const;
22
23 //mock API
24 void setCurrentTime(time_t currentTime);
25 void setMockPrefix(const std::string & mockPrefix);
26 void close();
27 private:
28 void initialisationPClockMockFile();
29
30 ///Mock handler
31 PGenericFileMock<time_t> p_mock;
32 };
33
34 bool phoenix_createMockBackend(PClockMockFile & mock, const std::string & prefix = "");
35 bool phoenix_createClockMock(const std::string & prefix, size_t nbTime, time_t firstTime = 0l, time_t timeIncrement = 1l);
36
37 ///Fill the given clock mock
38 /** @param[out] mock : clock mock to be filled
39 * @param nbTime : number of time values in the mock
40 * @param firstTime : value of the first time
41 * @param timeIncrement : increment between two consecutive times
42 */
43 template<class _TClockMock>
44 4 void phoenix_fillClockMock(_TClockMock & mock, size_t nbTime, time_t firstTime, time_t timeIncrement){
45 4 time_t currentTime(firstTime);
46
2/2
✓ Branch 0 (5→3) taken 4006 times.
✓ Branch 1 (5→6) taken 4 times.
4010 for(size_t i(0lu); i < nbTime; ++i){
47 4006 mock.setCurrentTime(currentTime);
48 4006 currentTime += timeIncrement;
49 }
50
51 4 }
52
53 #endif
54
55