fprime/Svc/DpManager/test/ut/DpManagerTestMain.cpp
Rob Bocchino b89b5d91c4
Add DpWriter (#2593)
* Pull in framework changes from data-products branch

* Pull in changes to DpManager from data-products branch

* Pull in DpWriter from data-products branch

* Fix spelling

* Revise FileNameString

* Fix warnings in CI

* Fix static analysis warnings

* Fix static analysis warnings

* Revise formatting and comments

* Revise banner comments

* Revise FileNameString per PR comment

* Revise path names in config headers

If a header H.hpp exists in the F Prime source base, then

is dangerous. Because [project root] and [fprime root] are both
in the list of include paths, it's not clear whether this means "include
[project root]/config/H.hpp" or "include [fprime root]/config/H.hpp."

On the other hand,

or

has no such ambiguity, because only one of [project root]/config
and [fprime root]/config is in the list of include paths.

* Revise path names in config headers

If a header H.hpp exists in the F Prime source base, then

`#include "config/H.hpp"`

is dangerous. Because [project root] and [fprime root] are both
in the list of include paths, it's not clear whether this means "include
[project root]/config/H.hpp" or "include [fprime root]/config/H.hpp."

On the other hand,

include <config/H.hpp>

or

`#include "config/H.hpp"`

has no such ambiguity, because only one of [project root]/config
and [fprime root]/config is in the list of include paths.
2024-03-28 16:09:38 -07:00

96 lines
2.8 KiB
C++

// ======================================================================
// \title DpWriterTestMain.cpp
// \author bocchino
// \brief cpp file for DpWriter component test main function
// ======================================================================
#include "Fw/Test/UnitTest.hpp"
#include "STest/Random/Random.hpp"
#include "Svc/DpManager/test/ut/Rules/Testers.hpp"
#include "Svc/DpManager/test/ut/Scenarios/Random.hpp"
namespace Svc {
TEST(BufferGetStatus, Invalid) {
COMMENT("Set the buffer get status to INVALID.");
BufferGetStatus::Tester tester;
tester.Invalid();
}
TEST(BufferGetStatus, Valid) {
COMMENT("Set the buffer get status to VALID.");
BufferGetStatus::Tester tester;
tester.Valid();
}
TEST(ProductGetIn, BufferInvalid) {
COMMENT("Invoke productGetIn in a state where the test harness returns an invalid buffer.");
REQUIREMENT("SVC-DPMANAGER-001");
REQUIREMENT("SVC-DPMANAGER-004");
ProductGetIn::Tester tester;
tester.BufferInvalid();
}
TEST(ProductGetIn, BufferValid) {
COMMENT("Invoke productGetIn in a state where the test harness returns a valid buffer.");
REQUIREMENT("SVC-DPMANAGER-001");
REQUIREMENT("SVC-DPMANAGER-004");
ProductGetIn::Tester tester;
tester.BufferValid();
}
TEST(ProductRequestIn, BufferInvalid) {
COMMENT("Invoke productRequestIn in a state where the test harness returns an invalid buffer.");
REQUIREMENT("SVC-DPMANAGER-002");
REQUIREMENT("SVC-DPMANAGER-004");
ProductRequestIn::Tester tester;
tester.BufferInvalid();
}
TEST(ProductRequestIn, BufferValid) {
COMMENT("Invoke productRequestIn in a state where the test harness returns a valid buffer.");
REQUIREMENT("SVC-DPMANAGER-002");
REQUIREMENT("SVC-DPMANAGER-004");
ProductRequestIn::Tester tester;
tester.BufferValid();
}
TEST(ProductSendIn, OK) {
COMMENT("Invoke productSendIn with nominal input.");
REQUIREMENT("SVC-DPMANAGER-003");
REQUIREMENT("SVC-DPMANAGER-004");
ProductSendIn::Tester tester;
tester.OK();
}
TEST(SchedIn, OK) {
COMMENT("Invoke schedIn with nominal input.");
REQUIREMENT("SVC-DPMANAGER-004");
SchedIn::Tester tester;
tester.OK();
}
TEST(CLEAR_EVENT_THROTTLE, OK) {
COMMENT("Send command CLEAR_EVENT_THROTTLE.");
CLEAR_EVENT_THROTTLE::Tester tester;
tester.OK();
}
TEST(Scenarios, Random) {
COMMENT("Random scenario with all rules.");
REQUIREMENT("SVC-DPMANAGER-002");
REQUIREMENT("SVC-DPMANAGER-003");
REQUIREMENT("SVC-DPMANAGER-004");
const FwSizeType numSteps = 10000;
Scenarios::Random::Tester tester;
tester.run(numSteps);
}
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
STest::Random::seed();
return RUN_ALL_TESTS();
}