Revision 456, 1.0 kB
(checked in by vbarta, 15 years ago)
|
custom test location for harness tests (extended UnitTest?++), configurable tolerance - all tests pass (most of the time)
|
Line | |
---|
1 | /*! |
---|
2 | \file |
---|
3 | \brief Support for testing descendants of mpdf. |
---|
4 | \author Vaclav Barta. |
---|
5 | |
---|
6 | ----------------------------------- |
---|
7 | BDM++ - C++ library for Bayesian Decision Making under Uncertainty |
---|
8 | |
---|
9 | Using IT++ for numerical operations |
---|
10 | ----------------------------------- |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef MPDF_HARNESS_H |
---|
14 | #define MPDF_HARNESS_H |
---|
15 | |
---|
16 | #define BDMLIB // not an ideal way to prevent double registration of UI factories... |
---|
17 | |
---|
18 | #include "bdmroot.h" |
---|
19 | #include "itpp_ext.h" |
---|
20 | #include "shared_ptr.h" |
---|
21 | #include "base/bdmbase.h" |
---|
22 | #include "base/user_info.h" |
---|
23 | |
---|
24 | namespace bdm |
---|
25 | { |
---|
26 | |
---|
27 | class mpdf_harness : public root |
---|
28 | { |
---|
29 | private: |
---|
30 | shared_ptr<mpdf> hmpdf; |
---|
31 | vec cond; |
---|
32 | vec mean; |
---|
33 | int nsamples; |
---|
34 | mat R; |
---|
35 | double tolerance; |
---|
36 | |
---|
37 | public: |
---|
38 | static void test_config(const char *config_file_name); |
---|
39 | |
---|
40 | mpdf_harness():nsamples(1000), tolerance(0.1) { } |
---|
41 | |
---|
42 | virtual void test(const char *config_name, int idx); |
---|
43 | |
---|
44 | void from_setting(const Setting &set); |
---|
45 | |
---|
46 | protected: |
---|
47 | mpdf *get_mpdf() { return hmpdf.get(); } |
---|
48 | }; |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | #endif |
---|