33 #include "DGtal/math/Statistic.h"
38 using namespace DGtal;
49 unsigned int nbok = 0;
56 for(
unsigned int k=0; k < 1000; k++)
62 nbok += (stat.
mean()==499.5) ? 1 : 0;
65 nbok += (stat.
max()==999) ? 1 : 0;
67 nbok += (stat.
min()==0) ? 1 : 0;
69 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
70 <<
"true == true" << std::endl;
82 unsigned int nbok = 0;
90 for(
unsigned int k=0; k < 100; k++)
93 for(
unsigned int k=0; k < 100; k++)
99 nbok += (stat.
mean()==88) ? 1 : 0;
102 nbok += (stat.
max()==99) ? 1 : 0;
104 nbok += (stat.
min()==77) ? 1 : 0;
106 nbok += (stat.
median()==88) ? 1 : 0;
108 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
109 <<
"true == true" << std::endl;
118 int main(
int argc,
char** argv )
122 for (
int i = 0; i < argc; ++i )
127 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
129 trace.
beginBlock (
"Testing class Statistics (with option for saving samples)" );
131 for (
int i = 0; i < argc; ++i )
136 trace.
emphase() << ( res2 ?
"Passed." :
"Error." ) << endl;
140 return (res &&res2) ? 0 : 1;
Aim: This class processes a set of sample values for one variable and can then compute different stat...
void addValue(Quantity v)
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
bool testStatisticsSaving()