Skip to content
Snippets Groups Projects
Commit 1f4d1f56 authored by marco's avatar marco
Browse files

unit test for parsing atom record

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2038 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent fea769b4
Branches
Tags
No related merge requests found
......@@ -28,7 +28,8 @@ using namespace ost::io;
BOOST_AUTO_TEST_SUITE( io )
BOOST_AUTO_TEST_CASE(test_io_pdb)
BOOST_AUTO_TEST_CASE(test_pdb_import_handler)
{
String fname("testfiles/test_in.pdb");
......@@ -46,6 +47,38 @@ BOOST_AUTO_TEST_CASE(test_io_pdb)
pdbh.Import(eh,"testfiles/pdb/simple.pdb");
}
BOOST_AUTO_TEST_CASE(atom_record)
{
String fname("testfiles/pdb/atom.pdb");
PDBReader reader(fname);
mol::EntityHandle ent=mol::CreateEntity();
reader.Import(ent);
BOOST_REQUIRE_EQUAL(ent.GetChainCount(), 2);
BOOST_REQUIRE_EQUAL(ent.GetResidueCount(), 2);
BOOST_REQUIRE_EQUAL(ent.GetAtomCount(), 2);
mol::AtomHandle a1=ent.FindChain("A").GetAtomList()[0];
BOOST_CHECK_EQUAL(a1.GetName(), "N");
BOOST_CHECK_EQUAL(a1.GetResidue().GetName(), "MET");
BOOST_CHECK_EQUAL(a1.GetResidue().GetChain().GetName(), "A");
BOOST_CHECK_EQUAL(a1.GetPos(), geom::Vec3(16.0, 64.0, 8.0));
BOOST_CHECK_EQUAL(a1.GetProp().b_factor, 1.0);
BOOST_CHECK_EQUAL(a1.GetProp().occupancy, 0.5);
BOOST_CHECK_EQUAL(a1.GetProp().element, "N");
BOOST_CHECK_EQUAL(a1.GetProp().is_hetatm, false);
mol::AtomHandle a2=ent.FindChain(" ").GetAtomList()[0];
BOOST_CHECK_EQUAL(a2.GetName(), "CA");
BOOST_CHECK_EQUAL(a2.GetResidue().GetName(), "MET");
BOOST_CHECK_EQUAL(a2.GetResidue().GetChain().GetName(), " ");
BOOST_CHECK_EQUAL(a2.GetPos(), geom::Vec3(32.0, -128.0, -2.5));
BOOST_CHECK_EQUAL(a2.GetProp().b_factor, 128.0);
BOOST_CHECK_EQUAL(a2.GetProp().occupancy, 1.0);
BOOST_CHECK_EQUAL(a2.GetProp().element, "C");
BOOST_CHECK_EQUAL(a2.GetProp().is_hetatm, true);
}
BOOST_AUTO_TEST_CASE(join_spread_records_on)
{
String fname("testfiles/pdb/join-spread-records.pdb");
......
ATOM 1 N MET A 1 16.000 64.000 8.000 0.50 1.00 N
HETATM 2 CA MET 1 32.000-128.000 -2.500 1.00128.00 C
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment