-
Notifications
You must be signed in to change notification settings - Fork 0
/
jaan_parameters_test.cpp
67 lines (63 loc) · 3.22 KB
/
jaan_parameters_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
#include "jaan_parameters.h"
#include <boost/test/unit_test.hpp>
// Boost.Test does not play well with -Weffc++
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
/* Correct use of Parameters ought to be that it only
* calls stuff from Parameters, never sets things.
* How do you test that?
*/
BOOST_AUTO_TEST_CASE(jaan_parameters_use) {
}
/* optimum preference: Must be between +/- the scaling value for pref when implemented.
* optimum trait: Must be between +/- the scaling value for trait when implemented.
* value of preference: Should be a warning for when preference
* is not an order of magnitude bigger than value of trait
*/
BOOST_AUTO_TEST_CASE(jaan_parameters_abuse) {
// Test max_generations is positive.
BOOST_CHECK_THROW(Parameters p(-1000, 1000, 20, 20, 10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test pop_size is positive.
BOOST_CHECK_THROW(Parameters p(1000, -1000, 20, 20, 10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test n_pref_genes is positive.
BOOST_CHECK_THROW(Parameters p(1000, 1000, -20, 20, 10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test n_trt_genes is positive.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, -20, 10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test n_qual_genes is positive.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, -10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test pref_and_trt_mu is below 1.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1,
0.01, 2, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test qual_inc_mu is below 1.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1,
0.01, 1e-02, 2, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test qual_dec_mu is below 1.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1,
0.01, 1e-02, 1e-02, 2, 1.2, 3, 2, 1),
std::invalid_argument);
// Test pref_and_trt_mu is above 0.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1, 0.01,
-1e-02, 1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test qual_inc_mu is above 0.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1, 0.01,
1e-02, -1e-02, 1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
// Test qual_dec_mu is above 0.
BOOST_CHECK_THROW(Parameters p(1000, 1000, 20, 20, 10, 0.0, 0.0, 1, 0.01,
1e-02, 1e-02, -1e-02, 1.2, 3, 2, 1),
std::invalid_argument);
}
#pragma GCC diagnostic pop