Skip to content
Snippets Groups Projects
Commit 06fe7540 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

prepared tests for array start and increment. Currently failing due to missing implementation

parent ef7ea4eb
No related branches found
No related tags found
No related merge requests found
......@@ -52,4 +52,26 @@ void checkDoocsProperty(std::string const & propertyAddress, bool expected_has_h
}
}
void checkSpectrum(std::string const & propertyAddress, bool expected_has_history = true, bool expected_is_writeable =true, float expected_start = 0.0, float expected_increment = 1.0){
checkDoocsProperty<D_spectrum>(propertyAddress, expected_has_history, expected_is_writeable);
EqAdr ad;
EqData ed, res;
// obtain location pointer
ad.adr(propertyAddress.c_str());
EqFct *eqFct = eq_get(&ad);
BOOST_REQUIRE_MESSAGE( eqFct, "Could not get location for property "+propertyAddress);
auto propertyName = ChimeraTK::basenameFromAddress(propertyAddress);
D_spectrum * spectrum = dynamic_cast< D_spectrum *>(eqFct->find_property(propertyName));
BOOST_REQUIRE_MESSAGE(spectrum, "Could not find property " + propertyName + " (address "<< propertyAddress <<"), or property has unexpected type.");
std::cout << "The magic 4 " << spectrum->spec_time() << ", "
<< spectrum->spec_start() << ", "
<< spectrum->spec_inc() << ", "
<< spectrum->spec_status() << std::endl;
BOOST_CHECK( std::fabs(spectrum->spec_start() - expected_start) < 0.001 );
BOOST_CHECK( std::fabs(spectrum->spec_inc() - expected_increment) < 0.001 );
}
#endif // SERVER_BASED_TEST_TOOLS_H
......@@ -6,6 +6,7 @@
#include <ChimeraTK/ControlSystemAdapter/Testing/ReferenceTestApplication.h>
#include <doocs-server-test-helper/doocsServerTestHelper.h>
#include <thread>
#include "serverBasedTestTools.h"
ReferenceTestApplication referenceTestApplication("serverTestSpectrumArray");
......@@ -35,6 +36,13 @@ void testReadWrite(){
DoocsServerTestHelper::runUpdate();
std::cout << "ran update once, let's test " << std::endl;
checkSpectrum("//INT/TO_DEVICE_ARRAY");
checkSpectrum("//DOUBLE/TO_DEVICE_ARRAY");
checkSpectrum("//FLOAT/TO_DEVICE_ARRAY");
checkSpectrum("//INT/MY_RENAMED_INTARRAY",true, false);
checkSpectrum("//DOUBLE/FROM_DEVICE_ARRAY",true, false, 123., 0.56);
checkSpectrum("//FLOAT/FROM_DEVICE_ARRAY",true, false);
DoocsServerTestHelper::doocsSetSpectrum("//INT/TO_DEVICE_ARRAY", {140, 141, 142, 143, 144, 145, 146, 147, 148, 149} );
DoocsServerTestHelper::doocsSetSpectrum("//DOUBLE/TO_DEVICE_ARRAY", {240.3, 241.3, 242.3, 243.3, 244.3, 245.3, 246.3, 247.3, 248.3, 249.3} );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment