/usr/include/opengm/unittests/inferencetester.hxx is in libopengm-dev 2.3.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #pragma once
#ifndef OPENGM_TEST_INFERENCE_TESTER_HXX
#define OPENGM_TEST_INFERENCE_TESTER_HXX
#include <vector>
#include <typeinfo>
#include <opengm/opengm.hxx>
#include <opengm/unittests/test.hxx>
#include <opengm/unittests/inferencetests/test_base.hxx>
#include <opengm/operations/minimizer.hxx>
#include <opengm/operations/maximizer.hxx>
#include <opengm/operations/integrator.hxx>
/// \cond HIDDEN_SYMBOLS
namespace opengm {
namespace test {
template <class INF>
class InferenceTester
{
public:
typedef typename INF::GraphicalModelType GraphicalModelType;
void test(const typename INF::Parameter&);
//void addTest(TestBase<INF>*);
template<class TEST> void addTest(const TEST&);
InferenceTester();
~InferenceTester();
private:
std::vector<TestBase<INF>*> testList;
};
//***************
//IMPLEMENTATION
//***************
template<class INF>
InferenceTester<INF>::InferenceTester()
{
}
template<class INF>
InferenceTester<INF>::~InferenceTester()
{
for(size_t testId = 0; testId < testList.size(); ++testId) {
delete testList[testId];
}
}
template<class INF>
void InferenceTester<INF>::test(const typename INF::Parameter& infPara)
{
typedef typename GraphicalModelType::ValueType ValueType;
typedef typename GraphicalModelType::OperatorType OperatorType;
typedef typename INF::AccumulationType AccType;
for(size_t testId = 0; testId < testList.size(); ++testId) {
(*testList[testId]).test(infPara);
}
}
//template<class INF>
//void InferenceTester<INF>::addTest(TestBase<INF>* test)
//{
// testList.push_back(test);
//}
template<class INF>
template<class TEST>
void InferenceTester<INF>::addTest(const TEST& test)
{
testList.push_back(new TEST(test));
//*(testList.back()) = test;
}
}
}
/// \endcond
#endif
|