load 3x4 matrix from Boujou .ban file. And this example demonstrates Dart usage: how to generate a runtime test by comparing against reference values and submit results to Dart server dashboard.
#include <Base/Common/BIASpragma.hh>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <bias_config.h>
#include <Base/Math/Matrix3x4.hh>
#include <Base/Math/Vector.hh>
using namespace std;
using namespace BIAS;
int main(int argc, char* argv[] )
{
int result=0;
BIASASSERT(argc>0);
cout<<"Starting "<<argv[0]<<endl;
#ifdef BIAS_TESTS_DATA
string filename;
filename = string(BIAS_TESTS_DATA);
filename += "calib01.ban";
#else
string filename;
cout<<"BIAS_TESTS_DATA not defined."<<endl;
return -1;
#endif
cout<<"trying to load "<<filename<<endl;
if (result==0){
cout<<"successfully loaded "<<filename<<endl
<<"A: "<<A<<endl;
} else {
cout<<"Error. couls not load "<<filename<<endl;
result = -2000;
return result;
};
const double v[12] = {
405.1, -0.0678595, -96.8174, 3800.26,
-2.10686, -202.721, -68.4048, 3483.67,
-0.00379941, 0.00217521, -0.171449, 7.94237 };
cout<<"DBG reference v is: "<<endl;
for (unsigned int i=0; i<12;i++) cout<<v[i]<<" ";
cout<<endl;
const double eps=1E-10;
for (unsigned int i=0; i<12; i++) {
if (fabs(v[i] - A.
GetData()[i]) >eps){
cout<<"Error: mismatch for element "<<i<<" : "<<endl
<<"should be: "<<v[i]
<<endl;
result += -1*i;
}
}
int errCode = A.
LoadBan(filename, 3);
if (errCode == 0){
cout<<"Error: acces to Time 3 should return error but didn't."<<endl;
result += -100;
};
cout<<"done with result = "<<result<<endl;
return result;
}