Skip to content

Commit

Permalink
Add unit test for writing stereo bond flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvdm committed Apr 16, 2011
1 parent 644bd56 commit b32d9c4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set(tests
spectrophore
squareplanar
stereo
stereobonds
stereoperception
tetrahedral
tetranonplanar
Expand Down
33 changes: 33 additions & 0 deletions test/stereobondstest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "obtest.h"

#include <openbabel/mol.h>
#include <openbabel/obconversion.h>

using namespace OpenBabel;


int main()
{
OBMol mol;
OBAtom *begin = mol.NewAtom();
OBAtom *end = mol.NewAtom();
mol.AddBond(begin->GetIdx(), end->GetIdx(), 1, OB_WEDGE_BOND);
mol.GetBond(0)->SetWedge();


OBConversion conv;
conv.SetInAndOutFormats("mol", "mol");

// write the molecule
std::ofstream ofs("stereobonds.mol");
conv.Write(&mol, &ofs);
ofs.close();

std::ifstream ifs("stereobonds.mol");
conv.Read(&mol, &ifs);

OB_COMPARE( mol.GetBond(0)->IsWedge(), true );
}



0 comments on commit b32d9c4

Please sign in to comment.