fprime/Svc/ComAggregator/test/ut/ComAggregatorTester.hpp
M Starch 2ee27f82f3
Add Communication Aggregator Component (#4264)
* Add aggregator component

* Add com aggregator to subtopology

* Fix aggregator issues

* Format and SDD

* Add basic UTs

* Fix not-empty check, test

* sp

* Fix author tag

* Bump GDS for aggregation; timeout aggregator

* Bump comQueue event size

* Increase timeout for integration tests

* Update Fw/Buffer/Buffer.hpp

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>

* Update Svc/ComAggregator/CMakeLists.txt

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>

* Update Svc/ComAggregator/docs/sdd.md

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>

* Update Svc/ComAggregator/docs/sdd.md

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>

* Remove unused variable 'good' in action doClear

* A usage note about APID.

---------

Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
2025-10-13 16:28:57 -07:00

111 lines
3.3 KiB
C++

// ======================================================================
// \title ComAggregatorTester.hpp
// \author lestarch
// \brief hpp file for ComAggregator component test harness implementation class
// ======================================================================
#ifndef Svc_ComAggregatorTester_HPP
#define Svc_ComAggregatorTester_HPP
#include <vector>
#include "Svc/ComAggregator/ComAggregator.hpp"
#include "Svc/ComAggregator/ComAggregatorGTestBase.hpp"
namespace Svc {
class ComAggregatorTester final : public ComAggregatorGTestBase {
public:
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
// Maximum size of histories storing events, telemetry, and port outputs
static const FwSizeType MAX_HISTORY_SIZE = 20;
// Instance ID supplied to the component instance under test
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
// Queue depth supplied to the component instance under test
static const FwSizeType TEST_INSTANCE_QUEUE_DEPTH = 20;
public:
// ----------------------------------------------------------------------
// Construction and destruction
// ----------------------------------------------------------------------
//! Construct object ComAggregatorTester
ComAggregatorTester();
//! Destroy object ComAggregatorTester
~ComAggregatorTester();
public:
// ----------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------
//! Tests initial operation
void test_initial();
//! Tests fill operation
Fw::Buffer test_fill(bool expect_hold = false);
//! Tests fill operation
void test_fill_multi();
//! Tests full operation
void test_full();
//! Tests timeout operation
void test_timeout();
//! Tests timeout operation sends no empty buffer
void test_timeout_zero();
//! Tests hold while waiting on data return
void test_hold_while_waiting();
//! Tests clear operation
void test_clear();
//! Tests clear operation with held data
void test_clear_with_hold();
//! Helper to fill a buffer with random data
Fw::Buffer fill_buffer(U32 size);
//! Shadow aggregate a buffer for validation
void shadow_aggregate(const Fw::Buffer& buffer);
//! Validate against shadow aggregation
void validate_aggregation(const Fw::Buffer& buffer);
//! Helper to validate a buffer has been aggregated correctly
void validate_buffer_aggregated(const Fw::Buffer& buffer, const ComCfg::FrameContext& context);
private:
// ----------------------------------------------------------------------
// Helper functions
// ----------------------------------------------------------------------
//! Connect ports
void connectPorts();
//! Initialize components
void initComponents();
private:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
//! The component under test
ComAggregator component;
//! Shadow aggregation for validation
std::vector<U8> m_aggregation;
};
} // namespace Svc
#endif