modify tolerance policy
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
#ifndef FESA_TESTS_REFERENCE_REFERENCE_TOLERANCE_POLICY_H_
|
||||
#define FESA_TESTS_REFERENCE_REFERENCE_TOLERANCE_POLICY_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa::test {
|
||||
|
||||
enum class ReferenceToleranceBranch {
|
||||
kNearZero,
|
||||
kRelative,
|
||||
kZeroScaleExact,
|
||||
};
|
||||
|
||||
struct ReferenceToleranceRow {
|
||||
double fesa_value;
|
||||
double reference_value;
|
||||
};
|
||||
|
||||
struct ReferenceToleranceFamily {
|
||||
std::string identity;
|
||||
std::vector<std::string> components;
|
||||
bool blocking;
|
||||
std::vector<ReferenceToleranceRow> rows;
|
||||
};
|
||||
|
||||
struct ReferenceToleranceRowDecision {
|
||||
double absolute_error;
|
||||
double threshold;
|
||||
double relative_error;
|
||||
bool relative_error_applicable;
|
||||
ReferenceToleranceBranch branch;
|
||||
bool passed;
|
||||
};
|
||||
|
||||
struct ReferenceToleranceFamilyDecision {
|
||||
std::string identity;
|
||||
std::vector<std::string> components;
|
||||
bool blocking;
|
||||
double reference_scale;
|
||||
double near_zero_band;
|
||||
std::size_t near_zero_count;
|
||||
double relative_rms;
|
||||
double maximum_absolute_error;
|
||||
std::size_t worst_row;
|
||||
bool rms_passed;
|
||||
bool passed;
|
||||
std::string diagnostic_code;
|
||||
std::vector<ReferenceToleranceRowDecision> rows;
|
||||
std::size_t row_count{};
|
||||
};
|
||||
|
||||
struct ReferenceToleranceEvaluation {
|
||||
bool valid;
|
||||
std::string diagnostic_code;
|
||||
bool passed;
|
||||
std::vector<ReferenceToleranceFamilyDecision> families;
|
||||
};
|
||||
|
||||
class ReferenceTolerancePolicy {
|
||||
public:
|
||||
static constexpr double kNearZeroRatio = 0.01;
|
||||
static constexpr double kRelativeTolerance = 0.05;
|
||||
static constexpr double kRelativeRmsTolerance = 0.01;
|
||||
|
||||
static ReferenceToleranceEvaluation Evaluate(
|
||||
const std::vector<ReferenceToleranceFamily>& families);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user