fprime/Svc/SeqDispatcher/test/ut/SeqDispatcherTester.hpp
Zimri Leisher b0716ad605
Add sequence dispatcher component (#2731)
* Add sequence dispatcher component

* Add seq start port to cmd sequencer

* Update author names and some include paths

* Get fully compiling, move consts/enums to correct places, check for connections on init

* Add spelling exceptions

* Get unit tests almost compiling...

* Fix string type in port, call component init in test

* Fix unit test compilation errors and assertions

* Switch back to using StringBase

* Switch to FwIndexType, remove textLogIn

* UpperCamel events, add warning for unexpected seq start

* remove init method, add check for connected to getNextAvailableIdx

* Update sdd, change event from low to high, static cast a portnum

* Add state diagram, add more warnings, fix wrong header types, use assert instead of warning for runSeq

---------

Co-authored-by: Zimri Leisher <zimri.leisher@fireflyspace.com>
2024-09-17 17:55:09 -07:00

80 lines
2.3 KiB
C++

// ======================================================================
// \title SeqDispatcher/test/ut/Tester.hpp
// \author zimri.leisher
// \brief hpp file for SeqDispatcher test harness implementation class
// ======================================================================
#ifndef TESTER_HPP
#define TESTER_HPP
#include "SeqDispatcherGTestBase.hpp"
#include "Svc/SeqDispatcher/SeqDispatcher.hpp"
namespace Svc{
class SeqDispatcherTester : public SeqDispatcherGTestBase {
// ----------------------------------------------------------------------
// Construction and destruction
// ----------------------------------------------------------------------
public:
// Maximum size of histories storing events, telemetry, and port outputs
static const NATIVE_INT_TYPE MAX_HISTORY_SIZE = 10;
// Instance ID supplied to the component instance under test
static const NATIVE_INT_TYPE TEST_INSTANCE_ID = 0;
// Queue depth supplied to component instance under test
static const NATIVE_INT_TYPE TEST_INSTANCE_QUEUE_DEPTH = 10;
//! Construct object SeqDispatcherTester
//!
SeqDispatcherTester();
//! Destroy object SeqDispatcherTester
//!
~SeqDispatcherTester();
public:
// ----------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------
void testDispatch();
void testLogStatus();
private:
// ----------------------------------------------------------------------
// Handlers for typed from ports
// ----------------------------------------------------------------------
void seqRunOut_handler(
FwIndexType portNum, //!< The port number
const Fw::StringBase& filename //!< The sequence file
);
private:
// ----------------------------------------------------------------------
// Helper methods
// ----------------------------------------------------------------------
//! Connect ports
//!
void connectPorts();
//! Initialize components
//!
void initComponents();
private:
// ----------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------
//! The component under test
//!
SeqDispatcher component;
};
} // end namespace components
#endif