mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
* Update fpp version Add more warnings to FppTest * Update fpp version Add warnings to build * Enable warnings in unit tests Fix warnings * Clean up test code * Update fpp version Remove workarounds in unit test builds * Update fpp version Fix warnings * Revise DpManager tests Remove conversion warnings * Revise DpWriter tests Remove conversion warnings * Refactor Hash Provide a size type to remove dependencies on NATIVE_INT_TYPE, which is going away. * Revise top-level CMakeLists.txt * Fix warnings in Ref * Fix warnings in Ref, RPI * Revise warning flags * Revise code to eliminate warnings * Revise code to fix warnings * Revise code to fix warnings * Revise code to fix warnings * Revise Serializable.cpp * Revise Serializable.cpp * Revise warning flags * Fix warnings in test code * Fix warnings * Fix warnings * Fix warnings and static analysis errors * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Turn off -Wshadow for unit tests * Revise comments * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Fix warnings * Enable -Wshadow for main ut builds * Revise compile options * Remove commented-out code * Update STest Eliminate warnings * Fix warning * Fix warnings * Fix warning * Fix warning * Fix warning * Revise comments * Revise static cast expression * Cast return type to void * Remove unneeded cast * Fix warnings that appear on the F Prime dev machine * Fix more warnings * Enable more warnings * Update fpp version * Remove commented-out compiler flags * Enable warning flag in CmdDispatcher * Disable -Wconversion in gtest * Revise compiler warning flags * Revise compiler options * Revise compiler flags * Revise compiler flags * Revise compiler flags * Revise compiler flags * Revise Buffer * Fix comments * Fix warning flags * Fix compiler warning flags * Fix compiler warnings * Fix compiler warning flags * Fix compiler warnings * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Fix compiler warning flags * Revise compiler warning flags * Restore deleted test * Fixing UT_TARGET collision --------- Co-authored-by: Robert L Bocchino <bocchino@fprime-fsw-0.jpl.nasa.gov> Co-authored-by: Michael D Starch <Michael.D.Starch@jpl.nasa.gov> Co-authored-by: M Starch <LeStarch@googlemail.com>
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
// ======================================================================
|
|
// \title RandomScenario.hpp
|
|
// \author bocchino
|
|
// \brief Apply rules in a random sequence
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2017 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
// ======================================================================
|
|
|
|
#ifndef STest_RandomScenario_HPP
|
|
#define STest_RandomScenario_HPP
|
|
|
|
#include "STest/Scenario/InterleavedScenario.hpp"
|
|
#include "STest/Scenario/RepeatedRuleScenario.hpp"
|
|
|
|
namespace STest {
|
|
|
|
//! Apply rules in a random sequence
|
|
template<typename State> class RandomScenario :
|
|
public InterleavedScenario<State>
|
|
{
|
|
|
|
public:
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Constructors and destructors
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Construct a RandomScenario from an array of rules
|
|
RandomScenario(
|
|
const char *const a_name, //!< The name of the scenario
|
|
Rule<State>** rules, //!< The rules in the array
|
|
const U32 size //!< The size of the array
|
|
) :
|
|
InterleavedScenario<State>(a_name, new Scenario<State>*[size], size)
|
|
{
|
|
assert(this->scenarioArray != nullptr);
|
|
Scenario<State>** scenarios = this->scenarioArray->getScenarios();
|
|
assert(scenarios != nullptr);
|
|
for (U32 i = 0; i < size; ++i) {
|
|
scenarios[i] = new RepeatedRuleScenario<State>(*rules[i]);
|
|
}
|
|
}
|
|
|
|
//! Destroy a RandomScenario
|
|
~RandomScenario() {
|
|
assert(this->scenarioArray != nullptr);
|
|
Scenario<State>** scenarios = this->scenarioArray->getScenarios();
|
|
assert(scenarios != nullptr);
|
|
for (U32 i = 0; i < this->scenarioArray->size; ++i) {
|
|
assert(scenarios[i] != nullptr);
|
|
delete scenarios[i];
|
|
}
|
|
delete[] scenarios;
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|