2809 |
06 Aug 12 |
peter |
1 |
/* |
2809 |
06 Aug 12 |
peter |
Copyright (C) 2012 Peter Johansson |
2809 |
06 Aug 12 |
peter |
3 |
|
2809 |
06 Aug 12 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2809 |
06 Aug 12 |
peter |
5 |
|
2809 |
06 Aug 12 |
peter |
The yat library is free software; you can redistribute it and/or |
2809 |
06 Aug 12 |
peter |
modify it under the terms of the GNU General Public License as |
2809 |
06 Aug 12 |
peter |
published by the Free Software Foundation; either version 3 of the |
2809 |
06 Aug 12 |
peter |
License, or (at your option) any later version. |
2809 |
06 Aug 12 |
peter |
10 |
|
2809 |
06 Aug 12 |
peter |
The yat library is distributed in the hope that it will be useful, |
2809 |
06 Aug 12 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2809 |
06 Aug 12 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2809 |
06 Aug 12 |
peter |
General Public License for more details. |
2809 |
06 Aug 12 |
peter |
15 |
|
2809 |
06 Aug 12 |
peter |
You should have received a copy of the GNU General Public License |
2809 |
06 Aug 12 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2809 |
06 Aug 12 |
peter |
18 |
*/ |
2809 |
06 Aug 12 |
peter |
19 |
|
2881 |
18 Nov 12 |
peter |
20 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
21 |
|
2809 |
06 Aug 12 |
peter |
22 |
#include "Suite.h" |
2809 |
06 Aug 12 |
peter |
23 |
|
2809 |
06 Aug 12 |
peter |
24 |
#include "yat/statistics/Averager3.h" |
2809 |
06 Aug 12 |
peter |
25 |
|
2809 |
06 Aug 12 |
peter |
26 |
using namespace theplu::yat; |
2809 |
06 Aug 12 |
peter |
27 |
using namespace theplu::yat::statistics; |
2809 |
06 Aug 12 |
peter |
28 |
|
2809 |
06 Aug 12 |
peter |
29 |
using theplu::yat::test::Suite; |
2809 |
06 Aug 12 |
peter |
30 |
|
2809 |
06 Aug 12 |
peter |
31 |
int main(int argc, char* argv[]) |
2809 |
06 Aug 12 |
peter |
32 |
{ |
2809 |
06 Aug 12 |
peter |
33 |
Suite suite(argc, argv); |
2809 |
06 Aug 12 |
peter |
34 |
|
2809 |
06 Aug 12 |
peter |
35 |
Averager3 a; |
2809 |
06 Aug 12 |
peter |
36 |
Averager3 copy(a); |
2809 |
06 Aug 12 |
peter |
37 |
a = copy; |
2809 |
06 Aug 12 |
peter |
38 |
a += copy; |
2809 |
06 Aug 12 |
peter |
39 |
|
2809 |
06 Aug 12 |
peter |
40 |
a.add(0, 9); |
2809 |
06 Aug 12 |
peter |
41 |
a.add(10); |
2809 |
06 Aug 12 |
peter |
42 |
|
2809 |
06 Aug 12 |
peter |
43 |
if (!suite.equal(a.central_moment3(), (-9.0 + std::pow(9.0,3))/10.0)) { |
2809 |
06 Aug 12 |
peter |
44 |
suite.add(false); |
2809 |
06 Aug 12 |
peter |
45 |
suite.err() << "central moment3 failed\n"; |
2809 |
06 Aug 12 |
peter |
46 |
} |
2809 |
06 Aug 12 |
peter |
47 |
a.reset(); |
2809 |
06 Aug 12 |
peter |
48 |
|
2809 |
06 Aug 12 |
peter |
49 |
a.add(1); |
2809 |
06 Aug 12 |
peter |
50 |
a.rescale(3); |
2809 |
06 Aug 12 |
peter |
51 |
a.rescale(5); |
2809 |
06 Aug 12 |
peter |
52 |
|
2809 |
06 Aug 12 |
peter |
53 |
return suite.return_value(); |
2809 |
06 Aug 12 |
peter |
54 |
} |