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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>
#include <BALLTestConfig.h>
///////////////////////////
#include <BALL/NMR/anisotropyShiftProcessor.h>
#include <BALL/FORMAT/HINFile.h>
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/STRUCTURE/defaultProcessors.h>
///////////////////////////
START_TEST(AnisotropyShiftProcessor)
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
using namespace BALL;
using namespace std;
AnisotropyShiftProcessor* ap = 0;
CHECK(AnisotropyShiftProcessor::AnisotropyShiftProcessor() throw())
ap = new AnisotropyShiftProcessor;
TEST_NOT_EQUAL(ap, 0)
RESULT
CHECK(AnisotropyShiftProcessor::~AnisotropyShiftProcessor() throw())
delete ap;
RESULT
CHECK(AnisotropyShiftProcessor::AnisotropyShiftProcessor(const AnisotropyShiftProcessor& processor) throw())
AnisotropyShiftProcessor asp;
AnisotropyShiftProcessor asp2(asp);
// there's not much here to test...
RESULT
CHECK(AnisotropyShiftProcessor::init() throw())
// tested below
RESULT
CHECK(AnisotropyShiftProcessor::start() throw())
// tested below
RESULT
CHECK(AnisotropyShiftProcessor::Processor::Result operator () (Composite& composite) throw())
// tested below
RESULT
CHECK(AnisotropyShiftProcessor::finish() throw())
// tested below
RESULT
HINFile f(BALL_TEST_DATA_PATH(AnisotropyShiftProcessor_test.hin));
System S;
f >> S;
Parameters parameters(BALL_TEST_DATA_PATH(AnisotropyShiftProcessor_test.ini));
CHECK(chemical shifts/with rings)
PRECISION(0.0001)
StringHashMap<float> aniso_shifts;
ifstream infile(BALL_TEST_DATA_PATH(AnisotropyShiftProcessor_test.dat));
String name;
float shift;
while (infile.good())
{
infile >> name >> shift;
if (name != "")
{
aniso_shifts.insert(name, shift);
}
}
TEST_EQUAL(aniso_shifts.size(), 15)
AnisotropyShiftProcessor sp;
sp.setParameters(parameters);
sp.init();
TEST_EQUAL(sp.isValid(), true)
TEST_EQUAL(S.countAtoms(), 31)
if (S.countAtoms() == 31)
{
S.apply(sp);
AtomIterator atom_it = S.beginAtom();
Position i = 0;
for (; +atom_it; ++atom_it)
{
if (atom_it->hasProperty(AnisotropyShiftProcessor::PROPERTY__ANISOTROPY_SHIFT))
{
shift = atom_it->getProperty(AnisotropyShiftProcessor::PROPERTY__ANISOTROPY_SHIFT).getFloat();
if (shift != 0)
{
STATUS("shift of " << atom_it->getFullName() << ": " << shift)
TEST_EQUAL(aniso_shifts.has(atom_it->getFullName()), true)
if (aniso_shifts.has(atom_it->getFullName()))
{
TEST_REAL_EQUAL(shift, aniso_shifts[atom_it->getFullName()])
i++;
}
else
{
TEST_REAL_EQUAL(shift, 0.0)
}
}
}
}
TEST_EQUAL(i, 15)
}
RESULT
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|