fprime/Fw/Logger/test/ut/LoggerRules.hpp
M Starch b76d8c9a0c
Update/types refactor as constants (#1623)
* lestarch: adding logical types implementation into Linux/StandardTypes.hpp

* lestarch: removing VxWorks StandardTypes from repository

* updated fprime types for correct compilation with vxworks and baremetal

* lestarch: refactoring types and configuration header w.r.t type design

* lestarch: replacing usages of AssertArg with FwAssertArgType

* lestarch: missspelled configuration

* lestarch: minor compilation fixes

* lestarch: renaming StandardTypes.hpp -> PlatformTypes.hpp

* lestarch: updating PRI tokens

* lestarch: replacing BasicTypes.hpp includes with FpConfig.hpp

* lestarch: UT and compilation fixes for types refactor

* lestarch: sp

* lestarch: fixing RPI issues in PassiveConsoleTextLogger

* lestarch: converting RPI build to debug

* lestarch: removing duplicate config imports

* lestarch: fixing documentation

* lestarch: fixing up multiple definitions and RPI compilation problems

* lestarch: reverting debug build

* lestarch: reverting platform types to class-based constants

* lestarch: reworking basic types

* lestarch: configured types refactor into classes

* lestarch: fixing bugs with static constants in classes

* lestarch: fixing platform types spelling and documentation

* lestarch: adding include guards to types headers

Co-authored-by: Kevin F Ortega <kevin.f.ortega@jpl.nasa.gov>
2022-08-18 13:25:56 -07:00

76 lines
2.1 KiB
C++

/**
* LoggerRules.hpp:
*
* This file specifies Rule classes for testing of the Fw::Logger. These rules can then be used by the main testing
* program to test the code.
*
* Logging rules:
*
* 1. a logger can be registered at any time.
* 2. NULL loggers discard log calls
* 3. if a valid logger is registered, the log message is called
*
* @author mstarch
*/
#ifndef FPRIME_LOGGERRULES_HPP
#define FPRIME_LOGGERRULES_HPP
#include <FpConfig.hpp>
#include <Fw/Types/String.hpp>
#include <Fw/Logger/test/ut/FakeLogger.hpp>
#include <STest/STest/Rule/Rule.hpp>
#include <STest/STest/Pick/Pick.hpp>
namespace LoggerRules {
/**
* Register:
*
* Rule to handle the registration of a logger to the global logger. It may also register a "NULL" logger and thus
* stop output logging.
*/
struct Register : public STest::Rule<MockLogging::FakeLogger> {
// Constructor
Register(const Fw::String& name);
// Check for registration, always allowed
bool precondition(const MockLogging::FakeLogger& truth);
// Register NULL or truth as the system logger
void action(MockLogging::FakeLogger& truth);
};
/**
* LogGood:
*
* As long as a non-NULL logger is set as the system logger, then valid log messages should be processed.
*/
struct LogGood : public STest::Rule<MockLogging::FakeLogger> {
// Constructor
LogGood(const Fw::String& name);
// Check for logging, only when not NULL
bool precondition(const MockLogging::FakeLogger& truth);
// Log valid messages
void action(MockLogging::FakeLogger& truth);
};
/**
* LogBad:
*
* As long as a non-NULL logger is set as the system logger, then valid log messages should be processed.
*/
struct LogBad : public STest::Rule<MockLogging::FakeLogger> {
// Constructor
LogBad(const Fw::String& name);
// Check for logging, only when not NULL
bool precondition(const MockLogging::FakeLogger& truth);
// Log valid messages
void action(MockLogging::FakeLogger& truth);
};
};
#endif //FPRIME_LOGGERRULES_HPP