WSL/SLF GitLab Repository

Commit 99cd5da7 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Fixed some errors and warnings when compiling the tests on Hera

parent 3c4f3dd3
......@@ -143,7 +143,7 @@ bool grid3d(const unsigned int& n) {
return status;
}
bool matrix(const unsigned int& n) {
bool matrix(const size_t& n) {
cout << "Testing Matrix\n";
bool status=true;
Matrix I(n,1.); //build an n*n identity matrix
......
......@@ -114,33 +114,31 @@ bool makeDEMfiles(){
bool compareFiles(){
bool status=true;
for(int i = 0; i < n_files; i++){
for(int i = 0; i < n_files; i++) {
// ------ Compare reference file with generated results ---------
cout << " --- Start comparing reference file with output file generated before for : " << files[i] << endl;
cout << " --- Comparing reference file with generated output file " << files[i] << endl;
ifstream ifref((prefix_ref+files[i]).c_str());
ifstream ifout(files[i].c_str());
string l_ref, l_out;
while (!ifref.eof())
{
if(ifout.eof()){
cerr << "Not enough lines generated as result!!!" << endl;
while (!ifref.eof()) {
if(ifout.eof()) {
cerr << "Generated file has less lines than the reference!" << endl;
return false;
}
getline(ifref,l_ref);
getline(ifout,l_out);
if (l_ref!=l_out) {
cerr << " ERROR, Sun generatet error at following point an error " << endl;
cerr << "Generated and reference files differ!" << endl;
cerr << "ref : \n " << l_ref << endl;
cerr << "out : \n " << l_out << endl;
status=false;
}
}
if(!ifout.eof()){
cerr << "To much lines generated as result!!!" << endl;
if(!ifout.eof()) {
cerr << "Generated file has more lines than the reference!" << endl;
status=false;
}
ifout.close();
......@@ -152,11 +150,11 @@ bool compareFiles(){
int main(void) {
if(!makeDEMfiles()){
if(!makeDEMfiles()) {
exit(1);
}
if(!compareFiles()){
if(!compareFiles()) {
exit(1);
}
......
......@@ -25,7 +25,7 @@ void cr_fixed_vectors(vector<double> &X, vector<double> &Y) {
void cr_rand_vectors(vector<double> &X, vector<double> &Y) {
const size_t N = 20;
srand( time(NULL) );
srand( static_cast<unsigned int>(time(NULL)) );
X.clear(); X.resize(N);
Y.clear(); Y.resize(N);
......@@ -191,7 +191,7 @@ bool check_basics(const vector<double>& X, const vector<double>& Y) {
}
//vector weighted mean
const vector<double> weights(X.size(), 1./(X.size()));
const vector<double> weights(X.size(), 1./static_cast<double>(X.size()));
const double vector_mean = Interpol1D::weightedMean(X, weights);
const double mean = Interpol1D::arithmeticMean(X);
const double vector_mean_status = IOUtils::checkEpsilonEquality(vector_mean, mean, 1e-6);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment