forked from Illumina/strelka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfastRanksum_test.cpp
86 lines (73 loc) · 2.47 KB
/
fastRanksum_test.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//
// Strelka - Small Variant Caller
// Copyright (c) 2009-2018 Illumina, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//
#include "boost/test/unit_test.hpp"
#include "fastRanksum.hh"
#include <cmath>
BOOST_AUTO_TEST_SUITE( test_fastRanksum )
BOOST_AUTO_TEST_CASE( test_fastRanksum )
{
for (unsigned polarity(0); polarity<2; ++polarity)
{
const bool v1(polarity == 0);
const bool v2(not v1);
fastRanksum r;
r.add_observation(v1, 44);
r.add_observation(v1, 45); //check tie both
r.add_observation(v2, 45);
r.add_observation(v2, 50);
r.add_observation(v1, 52);
r.add_observation(v1, 53);
r.add_observation(v1, 56);
r.add_observation(v1, 58); //check tie single
r.add_observation(v1, 58);
r.add_observation(v2, 61);
r.add_observation(v2, 63);
r.add_observation(v1, 65);
r.add_observation(v2, 75);
r.add_observation(v1, 79);
r.add_observation(v2, 85);
r.add_observation(v2, 93);
static const double tol(0.001);
BOOST_REQUIRE_CLOSE(1.27021, std::abs(r.get_z_stat()), tol);
}
}
BOOST_AUTO_TEST_CASE( test_fastRanksum2 )
{
for (unsigned polarity(0); polarity<2; ++polarity)
{
const bool v1(polarity==0);
const bool v2(not v1);
fastRanksum r;
r.add_observation(v1, 1);
r.add_observation(v1, 2);
r.add_observation(v1, 3);
r.add_observation(v1, 4);
r.add_observation(v1, 5);
r.add_observation(v1, 6);
r.add_observation(v1, 7);
r.add_observation(v1, 8);
r.add_observation(v1, 9);
r.add_observation(v1, 10);
r.add_observation(v2, 11);
r.add_observation(v2, 12);
static const double tol(0.001);
BOOST_REQUIRE_CLOSE(2.14834, std::abs(r.get_z_stat()), tol);
}
}
BOOST_AUTO_TEST_SUITE_END()