root/library/tests/enorm_test.cpp @ 450

Revision 450, 1.6 kB (checked in by vbarta, 15 years ago)

removed enorm<sq_T>::sample(int) - now spelled sample_m, inherited

  • Property svn:eol-style set to native
RevLine 
[428]1#define BDMLIB // not an ideal way to prevent double registration of UI factories...
[386]2#include "stat/exp_family.h"
[443]3#include "epdf_harness.h"
[428]4#include "mat_checks.h"
[436]5#include "test_util.h"
[428]6#include "UnitTest++.h"
7
[254]8using namespace bdm;
[179]9
[428]10const double epsilon = 0.00001;
[179]11
[428]12namespace UnitTest
13{
14
15inline void CheckClose(TestResults &results, const itpp::vec &expected,
16                       const itpp::vec &actual, double tolerance,
17                       TestDetails const& details) {
18    if (!AreClose(expected, actual, tolerance)) { 
19        MemoryOutStream stream;
20        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
21
22        results.OnTestFailure(details, stream.GetText());
23    }
24}
25
26inline void CheckClose(TestResults &results, const itpp::mat &expected,
27                       const itpp::mat &actual, double tolerance,
28                       TestDetails const& details) {
29    if (!AreClose(expected, actual, tolerance)) { 
30        MemoryOutStream stream;
31        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
32
33        results.OnTestFailure(details, stream.GetText());
34    }
35}
36
37}
38
[443]39template<>
40const ParticularUI<enorm<ldmat> > &ParticularUI<enorm<ldmat> >::factory(
41    ParticularUI<enorm<ldmat> >("enorm<ldmat>"));
42
43template<>
44const ParticularUI<enorm<fsqmat> > &ParticularUI<enorm<fsqmat> >::factory(
45    ParticularUI<enorm<fsqmat> >("enorm<fsqmat>"));
46
[428]47TEST(test_enorm) {
[443]48    RV::clear_all();
49    UIFile in("enorm.cfg");
50    Array<epdf_harness *> input;
51    UI::get(input, in, "data");
52    int sz = input.size();
53    CHECK(sz > 0);
54    for (int i = 0; i < sz; ++i) {
55        input(i)->test();
56    }
57}
Note: See TracBrowser for help on using the browser.