| Rosetta 3.2 Release Manual |
UTracer UT(“MyFile.u”);
UTracer UT(“MyFile.u”);
Real a,b,c;
vector<Real> va;
vector1<Real> v1a;
map<String, Real> map_string_real;
...
UT << “Some strings... \n”;
UT << “Some numbers:” << a << b << c << “\n”;
UT << “Vector type:” << va << “\n”;
UT << “Vector1 type:” << v1a << “\n”;
UT << “map type:” << map_string_real << “\n”;
Note: As with Tracer object symbol '\n' should be used for a new line, instead of using std::endl line symbol.
UTracer UT(“MyFile.u”);
Real a,b,c;
UT.delta(.001) << a; // a will be compared with precisions .001
UT.delta(.01) << b; // b will be compared with precisions .01
UT.delta(.1) << c; // b will be compared with precisions .1
UTracer UT(“MyFile.u”);
Real a,b,c;
UT.relative(.001) << a; // a will be compared with relative precisions .001
UT.relative(.01) << b; // b will be compared with relative precisions .01
UT.relative(.1) << c; // b will be compared with relative precisions .1
UTracer UT(“MyFile.u”);
Vector<Real> v;
...
UT.delta(.1).relative(.05); // set absolute precision as .1
// and set relative precision as 5%
for(i=0; i<v.size(); i++) {
UT << v[i];
}
Trick: to compare integer number with a precision convert them first to double, and then use UTracer functions 'delta' and 'relative' to compare.
1. In MyMover member function apply output this values to a special Tracer channel:
MyMover::apply(...) {
core::util::Tracer test_TR(“protocols.moves.MyMover.test”);
...
test_TR << “Test value 1:” << test_value_1 << “\n”;
test_TR << “Test value 2:” << test_value_2 << “\n”;
}
2. In unit test function, before starting testing MyMover class: create UTracer class and redirect core channel “protocols.moves.MyMover.test” to that UTracer object using static Tracer function 'set_ios_hook(VTracerOP tr, std::string monitoring_channels_list);'. So file MyMoverTest.cxxtest.hh can have something like:
test_MyMover() {
VTracerOP UT = new UTracer(“<somepath>/.../MyMover.u”);
core::util::set_ios_hook(UT, "protocols.moves.MyMover.test core.scoring");
...
MyMover mm(...); // creating MyMover object
...
mm.apply(...); // inside apply function test_value_1 and test_value_2 will be outputted to channel 'protocols.moves.MyMover.test' and in turn redirected to our UT object.
...
core::util::set_ios_hook(0, ""); // stopping redirection.
}
1.5.9