Index: library/tests/mgamma_test.cpp
===================================================================
--- library/tests/mgamma_test.cpp (revision 447)
+++ library/tests/mgamma_test.cpp (revision 456)
@@ -15,12 +15,4 @@
 
 TEST(test_mgamma) {
-    RV::clear_all();
-    UIFile in("mgamma.cfg");
-    Array<mpdf_harness *> input;
-    UI::get(input, in, "data");
-    int sz = input.size();
-    CHECK(sz > 0);
-    for (int i = 0; i < sz; ++i) {
-        input(i)->test();
-    }
+    mpdf_harness::test_config("mgamma.cfg");
 }
Index: library/tests/mat_checks.cpp
===================================================================
--- library/tests/mat_checks.cpp (revision 428)
+++ library/tests/mat_checks.cpp (revision 456)
@@ -37,2 +37,18 @@
 
 }
+
+const char *CurrentContext::config_name = "???";
+
+int CurrentContext::index = -1;
+
+CurrentContext::CurrentContext(const char *name, int idx)
+{
+    config_name = name;
+    index = idx;
+}
+
+CurrentContext::~CurrentContext()
+{
+    config_name = "???";
+    index = -1;
+}
Index: library/tests/epdf_harness.h
===================================================================
--- library/tests/epdf_harness.h (revision 442)
+++ library/tests/epdf_harness.h (revision 456)
@@ -36,9 +36,12 @@
     double integral;
     mat R;
+    double tolerance;
 
 public:
-    epdf_harness():nsamples(1000), integral(0) { }
+    static void test_config(const char *config_file_name);
 
-    virtual void test();
+    epdf_harness():nsamples(1000), integral(0), tolerance(0.1) { }
+
+    virtual void test(const char *config_name, int idx);
 
     void from_setting(const Setting &set);
@@ -46,4 +49,6 @@
 protected:
     epdf *get_epdf() { return hepdf.get(); }
+
+    double get_tolerance() const { return tolerance; }
 };
 
Index: library/tests/mepdf.cfg
===================================================================
--- library/tests/mepdf.cfg (revision 454)
+++ library/tests/mepdf.cfg (revision 456)
@@ -18,4 +18,5 @@
   mean = [ 1.1, -1.0 ];
   R = ( "matrix", 2, 2, [ 1.0, -0.5, -0.5, 2.0 ] );
+  tolerance = 0.3;
 } );
 
Index: library/tests/egiw.cfg
===================================================================
--- library/tests/egiw.cfg (revision 454)
+++ library/tests/egiw.cfg (revision 456)
@@ -13,9 +13,10 @@
   };
   mean = [ 1.1, 0.1 ];
-  lognc = 11.45368;
+  lognc = 3.39463;
   variance = [ 0.01, 8e-05 ];
   support = ( "matrix", 2, 2, [ -2.0, 4.0, 0.01, 2.0 ] );
   nbins = [ 100, 200 ];
   integral = 1.0;
+  tolerance = 0.2;
 },
 {
Index: library/tests/egiw_harness.cpp
===================================================================
--- library/tests/egiw_harness.cpp (revision 440)
+++ library/tests/egiw_harness.cpp (revision 456)
@@ -4,33 +4,4 @@
 #include "test_util.h"
 #include "UnitTest++.h"
-
-const double epsilon = 0.00001;
-
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
 
 namespace bdm {
@@ -41,12 +12,14 @@
 }
 
-void egiw_harness::test()
+void egiw_harness::test(const char *config_name, int idx)
 {
-    epdf_harness::test();
+    epdf_harness::test(config_name, idx);
+
+    CurrentContext cc(config_name, idx);
 
     egiw *wide = dynamic_cast<egiw *>(get_epdf());
     CHECK(wide);
 
-    CHECK_CLOSE(lognc, wide->lognc(), epsilon);
+    CHECK_CLOSE_EX(lognc, wide->lognc(), get_tolerance());
 }
 
Index: library/tests/mpdf_harness.h
===================================================================
--- library/tests/mpdf_harness.h (revision 447)
+++ library/tests/mpdf_harness.h (revision 456)
@@ -33,9 +33,12 @@
     int nsamples;
     mat R;
+    double tolerance;
 
 public:    
-    mpdf_harness():nsamples(1000) { }
+    static void test_config(const char *config_file_name);
 
-    virtual void test();
+    mpdf_harness():nsamples(1000), tolerance(0.1) { }
+
+    virtual void test(const char *config_name, int idx);
 
     void from_setting(const Setting &set);
Index: library/tests/egiw_test.cpp
===================================================================
--- library/tests/egiw_test.cpp (revision 440)
+++ library/tests/egiw_test.cpp (revision 456)
@@ -11,20 +11,4 @@
 const double epsilon = 0.00001;
 
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
-
 using namespace bdm;
 
@@ -38,13 +22,5 @@
 
 TEST(test_egiw) {
-    RV::clear_all();
-    UIFile in("egiw.cfg");
-    Array<epdf_harness *> input;
-    UI::get(input, in, "data");
-    int sz = input.size();
-    CHECK(sz > 0);
-    for (int i = 0; i < sz; ++i) {
-        input(i)->test();
-    }
+    epdf_harness::test_config("egiw.cfg");
 }
 
Index: library/tests/mepdf_test.cpp
===================================================================
--- library/tests/mepdf_test.cpp (revision 448)
+++ library/tests/mepdf_test.cpp (revision 456)
@@ -13,41 +13,6 @@
 const double epsilon = 0.00001;
 
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const& details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const& details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
-
 TEST(test_mepdf) {
-    RV::clear_all();
-    UIFile in("mepdf.cfg");
-    Array<mpdf_harness *> input;
-    UI::get(input, in, "data");
-    int sz = input.size();
-    CHECK(sz > 0);
-    for (int i = 0; i < sz; ++i) {
-        input(i)->test();
-    }
+    mpdf_harness::test_config("mepdf.cfg");
 }
 
Index: library/tests/square_mat_test.cpp
===================================================================
--- library/tests/square_mat_test.cpp (revision 455)
+++ library/tests/square_mat_test.cpp (revision 456)
@@ -6,22 +6,4 @@
 
 const double epsilon = 0.00001;
-
-bool fast = false;
-
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const& details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
 
 template<typename TMatrix>
Index: library/tests/epdf_harness.cpp
===================================================================
--- library/tests/epdf_harness.cpp (revision 447)
+++ library/tests/epdf_harness.cpp (revision 456)
@@ -1,36 +1,9 @@
 #include "epdf_harness.h"
+#include "base/bdmbase.h"
+#include "base/user_info.h"
 #include "stat/exp_family.h"
 #include "mat_checks.h"
 #include "test_util.h"
 #include "UnitTest++.h"
-
-const double epsilon = 0.00001;
-
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
 
 namespace bdm {
@@ -39,4 +12,17 @@
 const ParticularUI<epdf_harness> &ParticularUI<epdf_harness>::factory(
     ParticularUI<epdf_harness>("epdf_harness"));
+
+void epdf_harness::test_config(const char *config_file_name) {
+    RV::clear_all();
+
+    UIFile in(config_file_name);
+    Array<epdf_harness *> input;
+    UI::get(input, in, "data");
+    int sz = input.size();
+    CHECK(sz > 0);
+    for (int i = 0; i < sz; ++i) {
+        input(i)->test(config_file_name, i);
+    }
+}
 
 void epdf_harness::from_setting(const Setting &set) {
@@ -64,10 +50,16 @@
         UI::get(R, set, "R");
     }
+
+    if (set.exists("tolerance")) {
+        UI::get(tolerance, set, "tolerance");
+    }
 }
 
-void epdf_harness::test()
+void epdf_harness::test(const char *config_name, int idx)
 {
-    CHECK_CLOSE(mean, hepdf->mean(), epsilon);
-    CHECK_CLOSE(variance, hepdf->variance(), epsilon);
+    CurrentContext cc(config_name, idx);
+
+    CHECK_CLOSE_EX(mean, hepdf->mean(), tolerance);
+    CHECK_CLOSE_EX(variance, hepdf->variance(), tolerance);
 
     if (support.rows() == 2) {
@@ -85,6 +77,6 @@
 	}
 
-	CHECK_CLOSE(mean, num_mean2(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1);
-	CHECK_CLOSE(integral, normcoef(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1);
+	CHECK_CLOSE_EX(mean, num_mean2(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1);
+	CHECK_CLOSE_EX(integral, normcoef(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1);
     }
 
@@ -94,6 +86,6 @@
 	vec Emu = smp * ones(n) / n;
 	mat Er = (smp*smp.transpose())/n - outer_product(Emu,Emu);
-	CHECK_CLOSE(mean, Emu, 0.1);
-	CHECK_CLOSE(R, Er, 0.1);
+	CHECK_CLOSE_EX(mean, Emu, tolerance);
+	CHECK_CLOSE_EX(R, Er, tolerance);
     }
 }
Index: library/tests/square_mat_stress.cpp
===================================================================
--- library/tests/square_mat_stress.cpp (revision 438)
+++ library/tests/square_mat_stress.cpp (revision 456)
@@ -1,5 +1,4 @@
 #include "../bdm/math/square_mat.h"
 #include "../bdm/math/chmat.h"
-#include "mat_checks.h"
 #include "UnitTest++.h"
 #include "TestReporterStdout.h"
@@ -19,4 +18,11 @@
 namespace UnitTest
 {
+
+// can't include mat_checks.h because CheckClose is different in this file
+extern bool AreClose(const itpp::vec &expected, const itpp::vec &actual,
+		     double tolerance);
+
+extern bool AreClose(const itpp::mat &expected, const itpp::mat &actual,
+		     double tolerance);
 
 void CheckClose(TestResults &results, const itpp::mat &expected,
Index: library/tests/mat_checks.h
===================================================================
--- library/tests/mat_checks.h (revision 428)
+++ library/tests/mat_checks.h (revision 456)
@@ -19,10 +19,75 @@
 namespace UnitTest
 {
-  bool AreClose(const itpp::vec &expected, const itpp::vec &actual,
-		double tolerance);
 
-  bool AreClose(const itpp::mat &expected, const itpp::mat &actual,
-		double tolerance);
+bool AreClose(const itpp::vec &expected, const itpp::vec &actual,
+	      double tolerance);
+
+bool AreClose(const itpp::mat &expected, const itpp::mat &actual,
+	      double tolerance);
+
+inline void CheckClose(TestResults &results, const itpp::vec &expected,
+		       const itpp::vec &actual, double tolerance,
+		       TestDetails const &details) {
+    if (!AreClose(expected, actual, tolerance)) { 
+	MemoryOutStream stream;
+	stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
+
+	results.OnTestFailure(details, stream.GetText());
+    }
 }
 
+inline void CheckClose(TestResults &results, const itpp::mat &expected,
+		       const itpp::mat &actual, double tolerance,
+		       TestDetails const &details) {
+    if (!AreClose(expected, actual, tolerance)) { 
+        MemoryOutStream stream;
+        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+}
+
+/*! CHECK_CLOSE_EX macro should be used only in blocks having an
+  instance of this class (which sets the globals for error
+  reporting). */
+class CurrentContext
+{
+private:
+    static const char *config_name;
+    static int index;
+
+public:
+    // the pointer must stay valid for the lifetime of the object
+    CurrentContext(const char *name, int idx);
+    ~CurrentContext();
+
+    template< typename Expected, typename Actual, typename Tolerance >
+    static void CheckCloseEx(UnitTest::TestResults& results,
+			     Expected const& expected,
+			     Actual const& actual,
+			     Tolerance const& tolerance,
+			     UnitTest::TestDetails const& details) {
+        if (!UnitTest::AreClose(expected, actual, tolerance)) { 
+	    UnitTest::MemoryOutStream stream;
+	    stream << "error at " << config_name << '[' << index << "]: expected " << expected << " +/- " << tolerance << " but was " << actual;
+
+	    results.OnTestFailure(details, stream.GetText());
+	}
+    }
+};
+
+#define CHECK_CLOSE_EX(expected, actual, tolerance) \
+    do \
+    { \
+        try { \
+            CurrentContext::CheckCloseEx(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), 0, false)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
 #endif
Index: library/tests/mpdf_harness.cpp
===================================================================
--- library/tests/mpdf_harness.cpp (revision 447)
+++ library/tests/mpdf_harness.cpp (revision 456)
@@ -1,36 +1,9 @@
 #include "mpdf_harness.h"
+#include "base/bdmbase.h"
+#include "base/user_info.h"
 #include "stat/exp_family.h"
 #include "mat_checks.h"
 #include "test_util.h"
 #include "UnitTest++.h"
-
-const double epsilon = 0.00001;
-
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const &details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
 
 namespace bdm {
@@ -39,4 +12,17 @@
 const ParticularUI<mpdf_harness> &ParticularUI<mpdf_harness>::factory(
     ParticularUI<mpdf_harness>("mpdf_harness"));
+
+void mpdf_harness::test_config(const char *config_file_name) {
+    RV::clear_all();
+
+    UIFile in(config_file_name);
+    Array<mpdf_harness *> input;
+    UI::get(input, in, "data");
+    int sz = input.size();
+    CHECK(sz > 0);
+    for (int i = 0; i < sz; ++i) {
+        input(i)->test(config_file_name, i);
+    }
+}
 
 void mpdf_harness::from_setting(const Setting &set) {
@@ -50,14 +36,20 @@
 
     UI::get(R, set, "R");
+
+    if (set.exists("tolerance")) {
+        UI::get(tolerance, set, "tolerance");
+    }
 }
 
-void mpdf_harness::test()
+void mpdf_harness::test(const char *config_name, int idx)
 {
+    CurrentContext cc(config_name, idx);
+
     mat smp = hmpdf->samplecond_m(cond, nsamples);
     int n = smp.cols();
-    vec Emu = smp * ones(n) / n;
-    mat Er = (smp*smp.transpose())/n - outer_product(Emu,Emu);
-    CHECK_CLOSE(mean, Emu, 0.1);
-    CHECK_CLOSE(R, Er, 0.1);
+    vec emu = smp * ones(n) / n;
+    mat er = (smp * smp.T()) / n - outer_product(emu, emu);
+    CHECK_CLOSE_EX(mean, emu, tolerance);
+    CHECK_CLOSE_EX(R, er, tolerance);
 }
 
Index: library/tests/mgamma.cfg
===================================================================
--- library/tests/mgamma.cfg (revision 454)
+++ library/tests/mgamma.cfg (revision 456)
@@ -20,4 +20,5 @@
   mean = [ 1.5, 1.7 ];
   R = ( "matrix", 2, 2, [ 2.25, 0.0, 0.0, 2.89 ] );
+  tolerance = 0.5;
 } );
 
Index: library/tests/unittest-cpp/TestDetails.h
===================================================================
--- library/tests/unittest-cpp/TestDetails.h (revision 418)
+++ library/tests/unittest-cpp/TestDetails.h (revision 456)
@@ -7,6 +7,6 @@
 {
 public:
-    TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber);
-    TestDetails(const TestDetails& details, int lineNumber);
+    TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber, bool useFilename = true);
+    TestDetails(const TestDetails& details, int lineNumber, bool useFilename = true);
 
     char const* const suiteName;
@@ -14,4 +14,5 @@
     char const* const filename;
     int const lineNumber;
+    bool const useFilename;
 
     TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind
Index: library/tests/unittest-cpp/TestReporterStdout.cpp
===================================================================
--- library/tests/unittest-cpp/TestReporterStdout.cpp (revision 418)
+++ library/tests/unittest-cpp/TestReporterStdout.cpp (revision 456)
@@ -19,6 +19,14 @@
 #endif
 
-	using namespace std;
-    printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
+    using namespace std;
+
+    if (details.useFilename) {
+        // standard way
+	printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
+    } else { 
+        // extended for BDM - the failure string already includes
+	// (custom) test location info
+	printf("%s\n", failure);
+    }
 }
 
Index: library/tests/unittest-cpp/TestDetails.cpp
===================================================================
--- library/tests/unittest-cpp/TestDetails.cpp (revision 418)
+++ library/tests/unittest-cpp/TestDetails.cpp (revision 456)
@@ -3,17 +3,19 @@
 namespace UnitTest {
 
-TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_)
+TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_, bool useFilename_)
     : suiteName(suiteName_)
     , testName(testName_)
     , filename(filename_)
     , lineNumber(lineNumber_)
+    , useFilename(useFilename_)
 {
 }
 
-TestDetails::TestDetails(const TestDetails& details, int lineNumber_)
+TestDetails::TestDetails(const TestDetails& details, int lineNumber_, bool useFilename_)
     : suiteName(details.suiteName)
     , testName(details.testName)
     , filename(details.filename)
     , lineNumber(lineNumber_)
+    , useFilename(useFilename_)
 {
 }
Index: library/tests/enorm_test.cpp
===================================================================
--- library/tests/enorm_test.cpp (revision 454)
+++ library/tests/enorm_test.cpp (revision 456)
@@ -2,6 +2,4 @@
 #include "stat/exp_family.h"
 #include "epdf_harness.h"
-#include "mat_checks.h"
-#include "test_util.h"
 #include "UnitTest++.h"
 
@@ -9,31 +7,4 @@
 
 const double epsilon = 0.00001;
-
-namespace UnitTest
-{
-
-inline void CheckClose(TestResults &results, const itpp::vec &expected,
-		       const itpp::vec &actual, double tolerance,
-		       TestDetails const& details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-inline void CheckClose(TestResults &results, const itpp::mat &expected,
-		       const itpp::mat &actual, double tolerance,
-		       TestDetails const& details) {
-    if (!AreClose(expected, actual, tolerance)) { 
-        MemoryOutStream stream;
-        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
-
-        results.OnTestFailure(details, stream.GetText());
-    }
-}
-
-}
 
 template<>
@@ -50,12 +21,4 @@
 
 TEST(test_enorm) {
-    RV::clear_all();
-    UIFile in("enorm.cfg");
-    Array<epdf_harness *> input;
-    UI::get(input, in, "data");
-    int sz = input.size();
-    CHECK(sz > 0);
-    for (int i = 0; i < sz; ++i) {
-        input(i)->test();
-    }
+    epdf_harness::test_config("enorm.cfg");
 }
Index: library/tests/egiw_harness.h
===================================================================
--- library/tests/egiw_harness.h (revision 439)
+++ library/tests/egiw_harness.h (revision 456)
@@ -27,5 +27,5 @@
     egiw_harness():lognc(0) { }
 
-    void test();
+    void test(const char *config_name, int idx);
 
     void from_setting(const Setting &set);
Index: library/tests/egamma_test.cpp
===================================================================
--- library/tests/egamma_test.cpp (revision 446)
+++ library/tests/egamma_test.cpp (revision 456)
@@ -1,9 +1,6 @@
 #define BDMLIB // not an ideal way to prevent double registration of UI factories...
-#include "base/bdmbase.h"
 #include "base/user_info.h"
 #include "stat/exp_family.h"
-#include "itpp_ext.h"
 #include "epdf_harness.h"
-#include "mat_checks.h"
 #include "UnitTest++.h"
 
@@ -15,12 +12,4 @@
 
 TEST(test_egamma) {
-    RV::clear_all();
-    UIFile in("egamma.cfg");
-    Array<epdf_harness *> input;
-    UI::get(input, in, "data");
-    int sz = input.size();
-    CHECK(sz > 0);
-    for (int i = 0; i < sz; ++i) {
-        input(i)->test();
-    }
+    epdf_harness::test_config("egamma.cfg");
 }
Index: library/tests/enorm.cfg
===================================================================
--- library/tests/enorm.cfg (revision 454)
+++ library/tests/enorm.cfg (revision 456)
@@ -21,5 +21,5 @@
       names = ( "x" );
     };
-
+  tolerance = 0.2;
 },
 {
@@ -41,4 +41,5 @@
   nbins = [ 200, 200 ];
   integral = 1.0;
+  tolerance = 0.5;
 },
 {
@@ -58,4 +59,5 @@
   variance = [ 1 ];
   R = 1.0;
+  tolerance = 0.5;
 },
 {
@@ -105,4 +107,5 @@
   variance = [ 2.0, 0.5 ];
   R = ( "matrix", 2, 2, [ 2.0, 0.0, 0.0, 0.5 ] );
+  tolerance = 0.5;
 } );
 
