1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// unit tests for vihgo
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <cstring>
#include <algorithm>
#include <sys/time.h>
#include <sys/types.h>
#include "utils.h"
using namespace std;
int main(int argc, char* argv[])
{
cerr << "Starting unit tests" << endl;
int nTest = 0;
int nSuccessTest = 0;
// chisquare tests
vector<double> a;
vector<double> b;
a.push_back( 1 );
a.push_back( 10 );
b.push_back( 5 );
b.push_back( 100 );
nTest ++;
if ( chisquare(a, b) != 0.53737445246309 )
{
cerr << "Assertion fail for chisquare test : " << a[0] << " : " << a[1] << " vs " << b[0] << " : " << b[1] << " => pvalue from function = " << chisquare(a, b) << " ; should be 0.53737445246309 " << endl;
}
nTest ++;
if ( chisquare_Two(a, b) != 0.53737445246309 )
{
cerr << "Assertion fail for chisquare test : " << a[0] << " : " << a[1] << " vs " << b[0] << " : " << b[1] << " => pvalue from function = " << chisquare_Two(a, b) << " ; should be 0.53737445246309 " << endl;
}
return 0;
}
// end