Revision 689, 0.8 kB
(checked in by mido, 15 years ago)
|
new version of libconfig added
an improvement of testsuite - calling of "testsuite print" prints all the currently prepared unit tests
a CMakeLists.txt modificiation to remowe CMake 2.8 warnings
|
Line | |
---|
1 | #include "../bdm/base/datasources.h" |
---|
2 | #include "mat_checks.h" |
---|
3 | #include "UnitTest++.h" |
---|
4 | |
---|
5 | using namespace bdm; |
---|
6 | |
---|
7 | TEST ( EpdfDS_test ) { |
---|
8 | UIFile uif("epdfds.cfg"); |
---|
9 | |
---|
10 | shared_ptr<EpdfDS> ds=UI::build<EpdfDS>(uif, "ds"); |
---|
11 | |
---|
12 | vec mean = zeros(2); |
---|
13 | vec dt = zeros(2); |
---|
14 | for (int i=0; i<100; i++){ |
---|
15 | ds->step(); |
---|
16 | ds->getdata(dt); |
---|
17 | mean += dt; |
---|
18 | } |
---|
19 | CHECK_CLOSE_EX ( vec_2(1.0,2.0) ,mean/100, 1e-2); |
---|
20 | } |
---|
21 | |
---|
22 | TEST ( MpdfDS_test ) { |
---|
23 | UIFile uif("mpdfds.cfg"); |
---|
24 | |
---|
25 | shared_ptr<MpdfDS> ds=UI::build<MpdfDS>(uif, "ds", UI::compulsory); |
---|
26 | |
---|
27 | vec dt = zeros(2); |
---|
28 | vec ut="1.0"; |
---|
29 | ds->write(ut); |
---|
30 | for (int i=0; i<100; i++){ |
---|
31 | ds->step(); |
---|
32 | } |
---|
33 | ds->getdata(dt); |
---|
34 | CHECK_CLOSE ( -0.2 , dt(0), 1e-4); |
---|
35 | |
---|
36 | ut="2.0"; |
---|
37 | ds->write(ut); |
---|
38 | for (int i=0; i<100; i++){ |
---|
39 | ds->step(); |
---|
40 | } |
---|
41 | ds->getdata(dt); |
---|
42 | CHECK_CLOSE ( -0.4 , dt(0), 1e-4); |
---|
43 | } |
---|