Skip to content

Commit 74c799e

Browse files
authored
Updates for Svc/BufferAccumulator corresponding to UT cmake update for protected/private (#3786)
* Updates for Svc/BufferAccumulator corresponding to UT cmake udpate for protected/private * Rename dispatchOne to doDispatch for consistency
1 parent 07f418b commit 74c799e

File tree

6 files changed

+42
-31
lines changed

6 files changed

+42
-31
lines changed

Svc/BufferAccumulator/test/ut/Accumulate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Accumulate {
2323
void BufferAccumulatorTester ::OK() {
2424
ASSERT_EQ(BufferAccumulator_OpState::DRAIN, this->component.m_mode.e);
2525
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::ACCUMULATE);
26-
this->component.doDispatch();
26+
this->doDispatch();
2727
ASSERT_EQ(BufferAccumulator_OpState::ACCUMULATE, this->component.m_mode.e);
2828
ASSERT_FROM_PORT_HISTORY_SIZE(0);
2929

@@ -35,12 +35,12 @@ void BufferAccumulatorTester ::OK() {
3535
Fw::Buffer b(data, size, bufferID);
3636
buffers[i] = b;
3737
this->invoke_to_bufferSendInFill(0, buffers[i]);
38-
this->component.doDispatch();
38+
this->doDispatch();
3939
ASSERT_FROM_PORT_HISTORY_SIZE(0);
4040
}
4141

4242
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::DRAIN);
43-
this->component.doDispatch();
43+
this->doDispatch();
4444
ASSERT_EQ(BufferAccumulator_OpState::DRAIN, this->component.m_mode.e);
4545
ASSERT_FROM_PORT_HISTORY_SIZE(1);
4646
ASSERT_from_bufferSendOutDrain_SIZE(1);
@@ -49,7 +49,7 @@ void BufferAccumulatorTester ::OK() {
4949
U32 expectedNumBuffers = 1;
5050
for (U32 i = 0; i < MAX_NUM_BUFFERS; ++i) {
5151
this->invoke_to_bufferSendInReturn(0, buffers[i]);
52-
this->component.doDispatch();
52+
this->doDispatch();
5353
++expectedNumBuffers;
5454
if (i + 1 < MAX_NUM_BUFFERS) {
5555
++expectedNumBuffers;

Svc/BufferAccumulator/test/ut/BufferAccumulatorTester.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,8 @@ void BufferAccumulatorTester ::initComponents() {
130130
this->component.init(QUEUE_DEPTH, INSTANCE);
131131
}
132132

133+
void BufferAccumulatorTester ::doDispatch() {
134+
this->component.doDispatch();
135+
}
136+
133137
} // end namespace Svc

Svc/BufferAccumulator/test/ut/BufferAccumulatorTester.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ class BufferAccumulatorTester : public BufferAccumulatorGTestBase {
8181

8282
//! Whether to allocate/deallocate a queue for the user
8383
bool doAllocateQueue;
84+
85+
86+
// ----------------------------------------------------------------------
87+
// Methods
88+
// ----------------------------------------------------------------------
89+
90+
//! Helper method to call doDispatch
91+
void doDispatch(void);
8492
};
8593

8694
} // end namespace Svc

Svc/BufferAccumulator/test/ut/Drain.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ void BufferAccumulatorTester ::OK() {
3535
Fw::Buffer b(data, size, bufferID);
3636
buffers[i] = b;
3737
this->invoke_to_bufferSendInFill(0, buffers[i]);
38-
this->component.doDispatch();
38+
this->doDispatch();
3939
ASSERT_from_bufferSendOutDrain_SIZE(i + 1);
4040
ASSERT_from_bufferSendOutDrain(i, buffers[i]);
4141
this->invoke_to_bufferSendInReturn(0, buffers[i]);
42-
this->component.doDispatch();
42+
this->doDispatch();
4343
ASSERT_from_bufferSendOutReturn(i, buffers[i]);
4444
}
4545

@@ -48,7 +48,7 @@ void BufferAccumulatorTester ::OK() {
4848

4949
void BufferAccumulatorTester ::PartialDrainOK() {
5050
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::ACCUMULATE);
51-
this->component.doDispatch();
51+
this->doDispatch();
5252
ASSERT_CMD_RESPONSE_SIZE(1);
5353
ASSERT_CMD_RESPONSE(0, BufferAccumulator::OPCODE_BA_SETMODE, 0,
5454
Fw::CmdResponse::OK);
@@ -63,10 +63,10 @@ void BufferAccumulatorTester ::PartialDrainOK() {
6363
Fw::Buffer b(data, size, bufferID);
6464
buffers[i] = b;
6565
this->invoke_to_bufferSendInFill(0, buffers[i]);
66-
this->component.doDispatch();
66+
this->doDispatch();
6767

6868
this->sendCmd_BA_DrainBuffers(0, 0, 1, BufferAccumulator_BlockMode::BLOCK);
69-
this->component.doDispatch();
69+
this->doDispatch();
7070
ASSERT_EVENTS_BA_PartialDrainDone_SIZE(i + 1);
7171
ASSERT_EVENTS_BA_PartialDrainDone(i, 1u);
7272
// + 1 for first BufferAccumulator_OpState::ACCUMULATE command; + 1 for
@@ -79,7 +79,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
7979
ASSERT_from_bufferSendOutDrain(i, buffers[i]);
8080

8181
this->invoke_to_bufferSendInReturn(0, buffers[i]);
82-
this->component.doDispatch();
82+
this->doDispatch();
8383
ASSERT_from_bufferSendOutReturn(i, buffers[i]);
8484

8585
ASSERT_EVENTS_BA_PartialDrainDone_SIZE(i + 1);
@@ -99,7 +99,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
9999
Fw::Buffer b(data, size, bufferID);
100100
buffers[i] = b;
101101
this->invoke_to_bufferSendInFill(0, buffers[i]);
102-
this->component.doDispatch();
102+
this->doDispatch();
103103
ASSERT_FROM_PORT_HISTORY_SIZE(0);
104104
}
105105

@@ -108,7 +108,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
108108
ASSERT_from_bufferSendOutDrain_SIZE(i);
109109

110110
this->sendCmd_BA_DrainBuffers(0, 0, 1, BufferAccumulator_BlockMode::BLOCK);
111-
this->component.doDispatch();
111+
this->doDispatch();
112112
ASSERT_CMD_RESPONSE_SIZE(i + 1);
113113
ASSERT_CMD_RESPONSE(i, BufferAccumulator::OPCODE_BA_DRAINBUFFERS, 0,
114114
Fw::CmdResponse::OK);
@@ -121,7 +121,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
121121
ASSERT_from_bufferSendOutDrain_SIZE(i + 1);
122122
ASSERT_from_bufferSendOutDrain(i, buffers[i]);
123123
this->invoke_to_bufferSendInReturn(0, buffers[i]);
124-
this->component.doDispatch();
124+
this->doDispatch();
125125
ASSERT_from_bufferSendOutReturn(i, buffers[i]);
126126

127127
ASSERT_EVENTS_BA_PartialDrainDone_SIZE(i + 1);
@@ -140,7 +140,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
140140
Fw::Buffer b(data, size, bufferID);
141141
buffers[i] = b;
142142
this->invoke_to_bufferSendInFill(0, buffers[i]);
143-
this->component.doDispatch();
143+
this->doDispatch();
144144
ASSERT_FROM_PORT_HISTORY_SIZE(0);
145145
}
146146

@@ -152,7 +152,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
152152
ASSERT_EVENTS_BA_PartialDrainDone_SIZE(0);
153153
this->sendCmd_BA_DrainBuffers(0, 0, MAX_NUM_BUFFERS,
154154
BufferAccumulator_BlockMode::BLOCK);
155-
this->component.doDispatch();
155+
this->doDispatch();
156156
ASSERT_CMD_RESPONSE_SIZE(0);
157157

158158
for (U32 i = 0; i < MAX_NUM_BUFFERS; ++i) {
@@ -170,7 +170,7 @@ void BufferAccumulatorTester ::PartialDrainOK() {
170170
ASSERT_from_bufferSendOutDrain_SIZE(i + 1);
171171
ASSERT_from_bufferSendOutDrain(i, buffers[i]);
172172
this->invoke_to_bufferSendInReturn(0, buffers[i]);
173-
this->component.doDispatch();
173+
this->doDispatch();
174174
ASSERT_from_bufferSendOutReturn(i, buffers[i]);
175175
}
176176

Svc/BufferAccumulator/test/ut/Errors.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Errors {
2323
void BufferAccumulatorTester ::PartialDrain() {
2424
ASSERT_EQ(BufferAccumulator_OpState::DRAIN, this->component.m_mode.e);
2525
this->sendCmd_BA_DrainBuffers(0, 0, 1, BufferAccumulator_BlockMode::BLOCK);
26-
this->component.doDispatch(); // will fail - we are still in
26+
this->doDispatch(); // will fail - we are still in
2727
// BufferAccumulator_OpState::DRAIN mode
2828
ASSERT_EQ(BufferAccumulator_OpState::DRAIN, this->component.m_mode.e);
2929
ASSERT_FROM_PORT_HISTORY_SIZE(0);
@@ -32,12 +32,12 @@ void BufferAccumulatorTester ::PartialDrain() {
3232
ASSERT_EQ(0u, this->component.m_numToDrain);
3333

3434
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::ACCUMULATE);
35-
this->component.doDispatch();
35+
this->doDispatch();
3636
ASSERT_EQ(BufferAccumulator_OpState::ACCUMULATE, this->component.m_mode.e);
3737
ASSERT_FROM_PORT_HISTORY_SIZE(0);
3838

3939
this->sendCmd_BA_DrainBuffers(0, 0, 10, BufferAccumulator_BlockMode::BLOCK);
40-
this->component.doDispatch(); // will succeed - now we are in ACCUMULATE
40+
this->doDispatch(); // will succeed - now we are in ACCUMULATE
4141
ASSERT_EQ(BufferAccumulator_OpState::ACCUMULATE, this->component.m_mode.e);
4242
ASSERT_FROM_PORT_HISTORY_SIZE(
4343
0); // would be first buffer out, but we are empty
@@ -49,8 +49,7 @@ void BufferAccumulatorTester ::PartialDrain() {
4949
ASSERT_EQ(10u, this->component.m_numToDrain);
5050

5151
this->sendCmd_BA_DrainBuffers(0, 0, 1, BufferAccumulator_BlockMode::BLOCK);
52-
this->component
53-
.doDispatch(); // will fail - we are still doing a partial drain
52+
this->doDispatch(); // will fail - we are still doing a partial drain
5453
ASSERT_EVENTS_BA_StillDraining_SIZE(1);
5554
ASSERT_EVENTS_BA_StillDraining(0, 0u, 10u);
5655
ASSERT_EVENTS_BA_PartialDrainDone_SIZE(0); // partial drain not done
@@ -69,57 +68,57 @@ void BufferAccumulatorTester ::QueueFull() {
6968
// Go to Accumulate mode
7069
ASSERT_EQ(BufferAccumulator_OpState::DRAIN, this->component.m_mode.e);
7170
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::ACCUMULATE);
72-
this->component.doDispatch();
71+
this->doDispatch();
7372
ASSERT_EQ(BufferAccumulator_OpState::ACCUMULATE, this->component.m_mode.e);
7473
ASSERT_FROM_PORT_HISTORY_SIZE(0);
7574

7675
// Fill up the buffer queue
7776
for (U32 i = 0; i < MAX_NUM_BUFFERS; ++i) {
7877
this->invoke_to_bufferSendInFill(0, buffer);
79-
this->component.doDispatch();
78+
this->doDispatch();
8079
ASSERT_FROM_PORT_HISTORY_SIZE(0);
8180
}
8281

8382
// Send another buffer and expect an event
8483
this->invoke_to_bufferSendInFill(0, buffer);
85-
this->component.doDispatch();
84+
this->doDispatch();
8685
ASSERT_EVENTS_SIZE(1);
8786
ASSERT_EVENTS_BA_QueueFull_SIZE(1);
8887

8988
// Send another buffer and expect no new event
9089
this->invoke_to_bufferSendInFill(0, buffer);
91-
this->component.doDispatch();
90+
this->doDispatch();
9291
ASSERT_EVENTS_SIZE(1);
9392

9493
// Drain one buffer
9594
this->sendCmd_BA_SetMode(0, 0, BufferAccumulator_OpState::DRAIN);
96-
this->component.doDispatch();
95+
this->doDispatch();
9796
ASSERT_FROM_PORT_HISTORY_SIZE(1);
9897
ASSERT_from_bufferSendOutDrain_SIZE(1);
9998
ASSERT_from_bufferSendOutDrain(0, buffer);
10099

101100
// Send another buffer and expect an event
102101
this->invoke_to_bufferSendInFill(0, buffer);
103-
this->component.doDispatch();
102+
this->doDispatch();
104103
ASSERT_EVENTS_SIZE(2);
105104
ASSERT_EVENTS_BA_BufferAccepted_SIZE(1);
106105

107106
// Return the original buffer in order to drain one buffer
108107
this->invoke_to_bufferSendInReturn(0, buffer);
109-
this->component.doDispatch();
108+
this->doDispatch();
110109
ASSERT_FROM_PORT_HISTORY_SIZE(3);
111110
ASSERT_from_bufferSendOutDrain_SIZE(2);
112111
ASSERT_from_bufferSendOutDrain(1, buffer);
113112

114113
// Send another buffer and expect no new event
115114
this->invoke_to_bufferSendInFill(0, buffer);
116-
this->component.doDispatch();
115+
this->doDispatch();
117116
ASSERT_EVENTS_SIZE(2);
118117
ASSERT_EVENTS_BA_BufferAccepted_SIZE(1);
119118

120119
// Send another buffer and expect an event
121120
this->invoke_to_bufferSendInFill(0, buffer);
122-
this->component.doDispatch();
121+
this->doDispatch();
123122
ASSERT_EVENTS_SIZE(3);
124123
ASSERT_EVENTS_BA_QueueFull_SIZE(2);
125124

Svc/BufferAccumulator/test/ut/Health.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void BufferAccumulatorTester ::Ping() {
2020
U32 key = 42;
2121

2222
this->invoke_to_pingIn(0, key);
23-
this->component.doDispatch();
23+
this->doDispatch();
2424

2525
ASSERT_EVENTS_SIZE(0);
2626
ASSERT_from_pingOut_SIZE(1);

0 commit comments

Comments
 (0)