fprime/Svc/RateGroupDriver/test/ut/RateGroupDriverTester.cpp
Simone Morettini 36a07dd967
Implementation of the offsets in the RateGroupDriver (#2166)
* Implementation of the offsets

* Fix comment

* Fix spell error

* Changing configure interface by addind DividersSet

* Update RPI topology

* Removing numDivisors from call

* Removing memset clear as the constructor handles zeroed initialization

* Fixing ASSERT and removing m_numDivisors

* Renaming divisersSet to diviserSet

---------

Co-authored-by: Simone Morettini <simone.morettini@redwirespaceeurope.com>
Co-authored-by: Michael D Starch <Michael.D.Starch@jpl.nasa.gov>
2023-10-26 15:09:47 -07:00

56 lines
1.3 KiB
C++

/*
* RateGroupDriverTester.cpp
*
* Created on: Mar 18, 2015
* Author: tcanham
*/
#include <Svc/RateGroupDriver/test/ut/RateGroupDriverImplTester.hpp>
#include <Svc/RateGroupDriver/RateGroupDriver.hpp>
#include <Fw/Obj/SimpleObjRegistry.hpp>
#include <gtest/gtest.h>
#if FW_OBJECT_REGISTRATION == 1
static Fw::SimpleObjRegistry simpleReg;
#endif
void connectPorts(Svc::RateGroupDriver& impl, Svc::RateGroupDriverImplTester& tester) {
impl.set_CycleOut_OutputPort(0,tester.get_from_CycleOut(0));
impl.set_CycleOut_OutputPort(1,tester.get_from_CycleOut(1));
impl.set_CycleOut_OutputPort(2,tester.get_from_CycleOut(2));
tester.connect_to_CycleIn(0,impl.get_CycleIn_InputPort(0));
#if FW_PORT_TRACING
// Fw::PortBase::setTrace(true);
#endif
// simpleReg.dump();
}
TEST(RateGroupDriverTest,NominalSchedule) {
Svc::RateGroupDriver::DividerSet dividersSet{{{1, 0}, {2, 1}, {3, 0}}};
Svc::RateGroupDriver impl("RateGroupDriver");
impl.configure(dividersSet);
Svc::RateGroupDriverImplTester tester(impl);
tester.init();
impl.init();
// connect ports
connectPorts(impl,tester);
tester.runSchedNominal(dividersSet,FW_NUM_ARRAY_ELEMENTS(dividersSet.dividers));
}
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}