mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
* 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.
73 lines
3.1 KiB
C++
73 lines
3.1 KiB
C++
// ======================================================================
|
|
// \title Random.hpp
|
|
// \author Rob Bocchino
|
|
// \brief Random scenario
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2024 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government sponsorship
|
|
// acknowledged.
|
|
// ======================================================================
|
|
|
|
#include "STest/Scenario/BoundedScenario.hpp"
|
|
#include "STest/Scenario/RandomScenario.hpp"
|
|
#include "Svc/DpWriter/test/ut/Rules/Rules.hpp"
|
|
#include "Svc/DpWriter/test/ut/Scenarios/Random.hpp"
|
|
|
|
namespace Svc {
|
|
|
|
namespace Scenarios {
|
|
|
|
namespace Random {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Rule definitions
|
|
// ----------------------------------------------------------------------
|
|
|
|
Rules::BufferSendIn::BufferTooSmallForData bufferSendInBufferTooSmallForData;
|
|
Rules::BufferSendIn::BufferTooSmallForPacket bufferSendInBufferTooSmallForPacket;
|
|
Rules::BufferSendIn::FileOpenError bufferSendInFileOpenError;
|
|
Rules::BufferSendIn::FileWriteError bufferSendInFileWriteError;
|
|
Rules::BufferSendIn::InvalidBuffer bufferSendInInvalidBuffer;
|
|
Rules::BufferSendIn::InvalidHeader bufferSendInInvalidHeader;
|
|
Rules::BufferSendIn::InvalidHeaderHash bufferSendInInvalidHeaderHash;
|
|
Rules::BufferSendIn::OK bufferSendInOK;
|
|
Rules::CLEAR_EVENT_THROTTLE::OK clearEventThrottleOK;
|
|
Rules::FileOpenStatus::Error fileOpenStatusError;
|
|
Rules::FileOpenStatus::OK fileOpenStatusOK;
|
|
Rules::FileWriteStatus::Error fileWriteStatusError;
|
|
Rules::FileWriteStatus::OK fileWriteStatusOK;
|
|
Rules::SchedIn::OK schedInOK;
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Tests
|
|
// ----------------------------------------------------------------------
|
|
|
|
void Tester ::run(FwSizeType maxNumSteps) {
|
|
STest::Rule<TestState>* rules[] = {&bufferSendInBufferTooSmallForData,
|
|
&bufferSendInBufferTooSmallForPacket,
|
|
&bufferSendInFileOpenError,
|
|
&bufferSendInFileWriteError,
|
|
&bufferSendInInvalidBuffer,
|
|
&bufferSendInInvalidHeader,
|
|
&bufferSendInInvalidHeaderHash,
|
|
&bufferSendInOK,
|
|
&clearEventThrottleOK,
|
|
&fileOpenStatusError,
|
|
&fileOpenStatusOK,
|
|
&fileWriteStatusError,
|
|
&fileWriteStatusOK,
|
|
&schedInOK};
|
|
STest::RandomScenario<TestState> scenario("RandomScenario", rules,
|
|
sizeof(rules) / sizeof(STest::RandomScenario<TestState>*));
|
|
STest::BoundedScenario<TestState> boundedScenario("BoundedRandomScenario", scenario, maxNumSteps);
|
|
const U32 numSteps = boundedScenario.run(this->testState);
|
|
printf("Ran %u steps.\n", numSteps);
|
|
}
|
|
|
|
} // namespace Random
|
|
|
|
} // namespace Scenarios
|
|
|
|
} // namespace Svc
|