Revision 456, 1.1 kB
(checked in by vbarta, 16 years ago)
|
custom test location for harness tests (extended UnitTest?++), configurable tolerance - all tests pass (most of the time)
|
Rev | Line | |
---|
[436] | 1 | /*! |
---|
| 2 | \file |
---|
| 3 | \brief Support for testing descendants of epdf. |
---|
| 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 EPDF_HARNESS_H |
---|
| 14 | #define EPDF_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 epdf_harness : public root |
---|
| 28 | { |
---|
| 29 | private: |
---|
| 30 | shared_ptr<epdf> hepdf; |
---|
| 31 | vec mean; |
---|
| 32 | vec variance; |
---|
| 33 | mat support; |
---|
[442] | 34 | vec nbins; |
---|
[436] | 35 | int nsamples; |
---|
| 36 | double integral; |
---|
[441] | 37 | mat R; |
---|
[456] | 38 | double tolerance; |
---|
[436] | 39 | |
---|
| 40 | public: |
---|
[456] | 41 | static void test_config(const char *config_file_name); |
---|
[436] | 42 | |
---|
[456] | 43 | epdf_harness():nsamples(1000), integral(0), tolerance(0.1) { } |
---|
[436] | 44 | |
---|
[456] | 45 | virtual void test(const char *config_name, int idx); |
---|
| 46 | |
---|
[436] | 47 | void from_setting(const Setting &set); |
---|
[439] | 48 | |
---|
| 49 | protected: |
---|
| 50 | epdf *get_epdf() { return hepdf.get(); } |
---|
[456] | 51 | |
---|
| 52 | double get_tolerance() const { return tolerance; } |
---|
[436] | 53 | }; |
---|
| 54 | |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | #endif |
---|