Commit 2c9b6d65 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add test

parent 919eb8d7
Pipeline #96659 passed with stages
in 1 minute and 11 seconds
......@@ -24,6 +24,13 @@ bool checkMinMaxTab(const int * tabValue, size_t nbValue, int minVal, size_t min
b &= pmaxTab<int>(tabValue, nbValue) == maxVal;
b &= pmaxTabPos<int>(tabValue, nbValue) == maxPos;
int min(minVal), max(maxVal);
pminmaxTab(min, max, tabValue, nbValue);
// std::cout << "checkMinMaxTab : min = " << min << ", minVal = "<<minVal<<", max = " << max << ", maxVal = " << maxVal << std::endl;
b &= min == minVal && max == maxVal;
return b;
}
......
......@@ -214,12 +214,11 @@ void pminmaxTab(T & xmin, T & xmax, const T* tab, size_t size){
xmin = tab[0];
xmax = xmin;
if(size == 1lu) return;
size_t i;
T tmp;
for(i = 1; i < size; ++i){
for(size_t i(1lu); i < size; ++i){
tmp = tab[i];
if(tmp > xmax) xmax = tmp;
else{xmin = tmp;}
else if(tmp < xmin){xmin = tmp;}
}
}
......
Markdown is supported
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