#include "../demo_data_trigger_function.h"
{
cMyTestSystem()
{
LoadPlugin(
"demo_data_triggered_filter.adtfplugin");
}
};
{
auto pConfiguration = adtf::ucom::ucom_cast<adtf::base::IConfiguration*>(pFilter.
Get());
adtf::base::set_property_by_path<uint32_t>(*pConfiguration, "calculator_function/operator", eOperator);
return pFilter;
}
void test_calculation(cSimpleDataCalculator::tOperator eOperator, float fExpectedResult)
{
auto pFilter = create_filter(eOperator);
oWriter1.Write<float>(4.0, true);
oWriter2.Write<float>(2.0, true);
auto oOutputSamples = oOutput.GetCurrentOutput().GetSamples();
REQUIRE(oOutputSamples.size() == 1);
}
TEST_CASE_METHOD(cMyTestSystem, "Test Addition")
{
test_calculation(cSimpleDataCalculator::tOperator::ePLUS, 6.0);
}
TEST_CASE_METHOD(cMyTestSystem, "Test Substraction")
{
test_calculation(cSimpleDataCalculator::tOperator::eMINUS, 2.0);
}
TEST_CASE_METHOD(cMyTestSystem, "Test Multiplication")
{
test_calculation(cSimpleDataCalculator::tOperator::eMULTI, 8.0);
}
TEST_CASE_METHOD(cMyTestSystem, "Test Division")
{
test_calculation(cSimpleDataCalculator::tOperator::eDIVIDE, 2.0);
}
TEST_CASE_METHOD(cMyTestSystem, "Test Invalid Operator")
{
auto pFilter = create_filter(static_cast<cSimpleDataCalculator::tOperator>(cSimpleDataCalculator::tOperator::eDIVIDE + 1));
}
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Test Helper class that records triggers, types and samples created by a graph object.
Tester helper class to emulate a writing OutPin to InPin connection for sending samples and type to a...
@ State_Running
Filter is in streaming State, all pins are activated for streaming (Start() has been called):
Easy data access for input samples of non trivial type @T (see Supported types for adtf_memory<T> for...
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
This class enables you to setup an ADTF system where you can test your filters and services.
void LoadPlugin(const std::string &strPluginFileName, bool bCreateServices=true, base::ant::tADTFRunLevel nServicesRunlevel=base::tADTFRunLevel::RL_System)
Load a plugin and optionally create instances of all found ADTF Service classes.
virtual tResult CreateInstance(const char *strCID, iobject_ptr< IObject > &pObject, const tChar *strNameOfObject="") const =0
Creates a new instance of an object.
Object pointer implementation used for reference counting on objects of type IObject.
virtual T * Get() const
Get pointer to shared object.
adtf::ucom::IRuntime * _runtime
Global Runtime Pointer to reference to the current runtime.
Copyright © Audi Electronics Venture GmbH.