test/viz/PlotTester.cpp
/**
 * Method checking everything related to the data provider.
 */
Method checking everything related to the data provider.
Method checking everything related to the data provider .
BOOST_AUTO_TEST_CASE(checkDataProvider)
{
	auto myScatterPlot = make_shared<ScatterPlot>();
	auto myDataProvider = make_shared<DataProvider>();
	auto myPoints = make_shared<vector<DataPoint>>();
	DataPoint aPoint;
	aPoint.value = 3.0;
	aPoint.t = 1.0;
	aPoint.x = 2.0;
	myPoints->push_back(aPoint);
	aPoint.value = 2.0;
	aPoint.t = 3.0;
	aPoint.x = 2.0;
	myPoints->push_back(aPoint);
	aPoint.value = 5.0;
	aPoint.t = 6.0;
	aPoint.x = -2.0;
	myPoints->push_back(aPoint);
	aPoint.value = -8.0;
	aPoint.t = 8.0;
	aPoint.x = 5.0;
	myPoints->push_back(aPoint);
	aPoint.value = -7.0;
	aPoint.t = 7.0;
	aPoint.x = 7.0;
	myPoints->push_back(aPoint);
	myDataProvider->setDataPoints(myPoints);
	myScatterPlot->setDataProvider(myDataProvider);
	auto dataPoints = myScatterPlot->getDataProvider()->getDataPoints();
	for (unsigned int i = 0; i < dataPoints->size(); i++) {
		BOOST_REQUIRE_EQUAL(dataPoints->at(i).value, myPoints->at(i).value);
		BOOST_REQUIRE_EQUAL(dataPoints->at(i).t, myPoints->at(i).t);
		BOOST_REQUIRE_EQUAL(dataPoints->at(i).x, myPoints->at(i).x);
		BOOST_REQUIRE_EQUAL(dataPoints->at(i).y, myPoints->at(i).y);
		BOOST_REQUIRE_EQUAL(dataPoints->at(i).z, myPoints->at(i).z);
	}
}
BOOST_AUTO_TEST_CASE ( checkDataProvider ) { auto myScatterPlot = make_shared < ScatterPlot > ( ) ; auto myDataProvider = make_shared < DataProvider > ( ) ; auto myPoints = make_shared < vector < DataPoint > > ( ) ; DataPoint aPoint ; aPoint . value = 3.0 ; aPoint . t = 1.0 ; aPoint . x = 2.0 ; myPoints -> push_back ( aPoint ) ; aPoint . value = 2.0 ; aPoint . t = 3.0 ; aPoint . x = 2.0 ; myPoints -> push_back ( aPoint ) ; aPoint . value = 5.0 ; aPoint . t = 6.0 ; aPoint . x = -2.0 ; myPoints -> push_back ( aPoint ) ; aPoint . value = -8.0 ; aPoint . t = 8.0 ; aPoint . x = 5.0 ; myPoints -> push_back ( aPoint ) ; aPoint . value = -7.0 ; aPoint . t = 7.0 ; aPoint . x = 7.0 ; myPoints -> push_back ( aPoint ) ; myDataProvider -> setDataPoints ( myPoints ) ; myScatterPlot -> setDataProvider ( myDataProvider ) ; auto dataPoints = myScatterPlot -> getDataProvider ( ) -> getDataPoints ( ) ; for ( unsigned int i = 0 ; i < dataPoints -> size ( ) ; i ++ ) { BOOST_REQUIRE_EQUAL ( dataPoints -> at ( i ) . value , myPoints -> at ( i ) . value ) ; BOOST_REQUIRE_EQUAL ( dataPoints -> at ( i ) . t , myPoints -> at ( i ) . t ) ; BOOST_REQUIRE_EQUAL ( dataPoints -> at ( i ) . x , myPoints -> at ( i ) . x ) ; BOOST_REQUIRE_EQUAL ( dataPoints -> at ( i ) . y , myPoints -> at ( i ) . y ) ; BOOST_REQUIRE_EQUAL ( dataPoints -> at ( i ) . z , myPoints -> at ( i ) . z ) ; } }
Method checking everything related to the data provider.
Method checking everything related to the data provider .
// Create myScatterPlot // Create myDataProvider // Create a DataPoint vector // And fill it with some Point // Set these points in the myDataProvider // Set myDataProvider in myScatterPlot // Get the Points from the DataProvider from the Plot // Loop on all the points in dataPoints // Check that all the fields are the same