fprime/Ref/SignalGen/test/ut/Tester.cpp
Michael D Starch 1c4e2d2d17 Merge pull request #612 from joshuaa/fix-fw-obj-names
Refactor FW_OBJECT_NAMES switches and fix building without object names
2020-10-08 14:34:24 -07:00

126 lines
2.6 KiB
C++

// ======================================================================
// \title SignalGen.hpp
// \author mstarch
// \brief cpp file for SignalGen test harness implementation class
//
// \copyright
// Copyright 2009-2015, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#include "Tester.hpp"
#define INSTANCE 0
#define MAX_HISTORY_SIZE 10
#define QUEUE_DEPTH 10
namespace Ref {
// ----------------------------------------------------------------------
// Construction and destruction
// ----------------------------------------------------------------------
Tester ::
Tester(void) :
SignalGenGTestBase("Tester", MAX_HISTORY_SIZE),
component("SignalGen")
{
this->initComponents();
this->connectPorts();
}
Tester ::
~Tester(void)
{
}
// ----------------------------------------------------------------------
// Tests
// ----------------------------------------------------------------------
void Tester ::
test_start(void)
{
ASSERT_TLM_Output_SIZE(0);
sendCmd_SignalGen_Toggle(0, 0);
component.doDispatch();
invoke_to_schedIn(0, 0);
component.doDispatch();
ASSERT_TLM_Output_SIZE(1);
}
// ----------------------------------------------------------------------
// Helper methods
// ----------------------------------------------------------------------
void Tester ::
connectPorts(void)
{
// cmdIn
this->connect_to_cmdIn(
0,
this->component.get_cmdIn_InputPort(0)
);
// schedIn
this->connect_to_schedIn(
0,
this->component.get_schedIn_InputPort(0)
);
// timeCaller
this->component.set_timeCaller_OutputPort(
0,
this->get_from_timeCaller(0)
);
// cmdRegOut
this->component.set_cmdRegOut_OutputPort(
0,
this->get_from_cmdRegOut(0)
);
// logTextOut
this->component.set_logTextOut_OutputPort(
0,
this->get_from_logTextOut(0)
);
// logOut
this->component.set_logOut_OutputPort(
0,
this->get_from_logOut(0)
);
// cmdResponseOut
this->component.set_cmdResponseOut_OutputPort(
0,
this->get_from_cmdResponseOut(0)
);
// tlmOut
this->component.set_tlmOut_OutputPort(
0,
this->get_from_tlmOut(0)
);
}
void Tester ::
initComponents(void)
{
this->init();
this->component.init(
QUEUE_DEPTH, INSTANCE
);
}
} // end namespace Ref