Directory: | ./ |
---|---|
File: | TESTS/TEST_DAEMON_PINGPONG/PingPongDaemon.cpp |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 21 | 21 | 100.0% |
Branches: | 15 | 15 | 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 | |||
8 | #include "PingPongDaemon.h" | ||
9 | |||
10 | ///Default constructor of PingPongDaemon | ||
11 | 1 | PingPongDaemon::PingPongDaemon(){ | |
12 | 1 | initialisationPingPongDaemon(); | |
13 | 1 | } | |
14 | |||
15 | ///Destructor of PingPongDaemon | ||
16 | 2 | PingPongDaemon::~PingPongDaemon(){ | |
17 | |||
18 | } | ||
19 | |||
20 | ///Extra processing (here to test Ping-Pong mode) | ||
21 | 3 | void PingPongDaemon::extraLoopProcessing(){ | |
22 | //Let's send the Ping message to get the answer | ||
23 | 3 | sendPing(); | |
24 | 3 | } | |
25 | |||
26 | ///Initialisation function of the class PingPongDaemon | ||
27 | 1 | void PingPongDaemon::initialisationPingPongDaemon(){ | |
28 | 1 | p_isFirstPing = true; | |
29 | 1 | } | |
30 | |||
31 | ///Send a Ping message | ||
32 | 3 | void PingPongDaemon::sendPing(){ | |
33 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | if(!p_isFirstPing){ |
34 | 2 | return; | |
35 | } | ||
36 |
1/1✓ Branch 1 taken 1 times.
|
1 | Message pingPong; |
37 |
1/1✓ Branch 1 taken 1 times.
|
1 | pingPong.setType(MessageType::PING); |
38 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | pingPong.setSender(p_config.getName()); |
39 |
1/1✓ Branch 1 taken 1 times.
|
1 | pingPong.setSendTime(0lu); |
40 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | pingPong.getVecRecver().push_back("test"); |
41 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(sendMessage(pingPong)); |
42 | 1 | p_isFirstPing = false; | |
43 | 1 | } | |
44 | |||
45 |