#include "test_flow_postrocess_helper.h" UnderTestPost* setUpClassFlowPostprocessing(t_CNNType digType, t_CNNType anaType) { ClassFlowCNNGeneral* _analog; ClassFlowCNNGeneral* _digit; std::vector FlowControll; ClassFlowMakeImage* flowmakeimage; // wird im doFlow verwendet flowmakeimage = new ClassFlowMakeImage(&FlowControll); FlowControll.push_back(flowmakeimage); // Die Modeltypen werden gesetzt, da keine Modelle verwendet werden. _analog = new ClassFlowCNNGeneral(nullptr, anaType); _digit = new ClassFlowCNNGeneral(nullptr, digType); return new UnderTestPost(&FlowControll, _analog, _digit); } std::string process_doFlow(UnderTestPost* _underTestPost) { string time; // run test TEST_ASSERT_TRUE(_underTestPost->doFlow(time)); return _underTestPost->getReadout(0); } std::string process_doFlow(std::vector analog, std::vector digits, t_CNNType digType, bool checkConsistency, bool extendedResolution, int decimal_shift) { // setup the classundertest UnderTestPost* _undertestPost = init_do_flow(analog, digits, digType, checkConsistency, extendedResolution, decimal_shift); printf("SetupClassFlowPostprocessing completed.\n"); string time; // run test TEST_ASSERT_TRUE(_undertestPost->doFlow(time)); std::string result = _undertestPost->getReadout(0); delete _undertestPost; return result; } UnderTestPost* init_do_flow(std::vector analog, std::vector digits, t_CNNType digType, bool checkConsistency, bool extendedResolution, int decimal_shift) { UnderTestPost* _undertestPost = setUpClassFlowPostprocessing(digType, Analogue100); // digits if (digits.size()>0) { general* gen_digit = _undertestPost->flowDigit->GetGENERAL("default", true); gen_digit->ROI.clear(); for (int i = 0; iname = name; digitROI->result_klasse = (int) digits[i]; digitROI->result_float = digits[i]; gen_digit->ROI.push_back(digitROI); } } // analog if (analog.size()>0) { general* gen_analog = _undertestPost->flowAnalog->GetGENERAL("default", true); gen_analog->ROI.clear(); for (int i = 0; iname = name; anaROI->result_float = analog[i]; gen_analog->ROI.push_back(anaROI); } } printf("Setting up of ROIs completed.\n"); _undertestPost->InitNUMBERS(); setConsitencyCheck(_undertestPost, checkConsistency); setExtendedResolution(_undertestPost, extendedResolution); setDecimalShift(_undertestPost, decimal_shift); return _undertestPost; } void setPreValue(UnderTestPost* _underTestPost, double _preValue) { if (_preValue>0) { printf("preValue=%f", _preValue); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->PreValue = _preValue; } } } void setAllowNegatives(UnderTestPost* _underTestPost, bool _allowNegatives) { printf("checkConsistency=true\n"); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->AllowNegativeRates = _allowNegatives; } } void setConsitencyCheck(UnderTestPost* _underTestPost, bool _checkConsistency) { if (_checkConsistency) { printf("checkConsistency=true\n"); std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->checkDigitIncreaseConsistency = true; } } } void setExtendedResolution(UnderTestPost* _underTestPost, bool _extendedResolution) { if (_extendedResolution ) { std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { (*NUMBERS)[_n]->isExtendedResolution = true; } } } void setDecimalShift(UnderTestPost* _underTestPost, int _decimal_shift) { if (_decimal_shift!=0) { std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { printf("Setting decimal shift on number: %d to %d\n", _n, _decimal_shift); (*NUMBERS)[_n]->DecimalShift = _decimal_shift; (*NUMBERS)[_n]->DecimalShiftInitial = _decimal_shift; } } } void setAnalogdigitTransistionStart(UnderTestPost* _underTestPost, float _analogdigitTransistionStart) { if (_analogdigitTransistionStart!=0) { std::vector* NUMBERS = _underTestPost->GetNumbers(); for (int _n = 0; _n < (*NUMBERS).size(); ++_n) { printf("Setting decimal shift on number: %d to %f\n", _n, _analogdigitTransistionStart); (*NUMBERS)[_n]->AnalogDigitalTransitionStart = _analogdigitTransistionStart; } } }