<commit_before>// $Id: Bond_test.C,v 1.12 2000/05/31 01:01:46 amoll Exp $
#include <BALL/CONCEPT/classTest.h>

///////////////////////////
#include <BALL/KERNEL/bond.h>
#include <BALL/KERNEL/atom.h>
#include <BALL/COMMON/exception.h>
#include <BALL/CONCEPT/textPersistenceManager.h>
#include <BALL/KERNEL/fragment.h>
#include <BALL/KERNEL/molecule.h>
#include <BALL/KERNEL/system.h>
///////////////////////////

START_TEST(Bond, "$Id: Bond_test.C,v 1.12 2000/05/31 01:01:46 amoll Exp $")

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

using namespace BALL;
String filename;
using std::ofstream;
using std::ios;
using namespace RTTI;
	
Bond*	b;

CHECK(Bond())
	b = new Bond;
	TEST_NOT_EQUAL(b, 0)
RESULT											

CHECK(~Bond())
	delete b;
RESULT

CHECK(Bond(const Bond& bond, bool deep = true))
	Atom a1;
	Atom a2;
	Bond b1, b2;
	b1.setFirstAtom(&a1);
	TEST_EQUAL(b1.getFirstAtom(), &a1);
	b1.setFirstAtom(&a2);
	TEST_EQUAL(b1.getFirstAtom(), &a2);
RESULT		

CHECK(Bond(String&, Atom&, Atom&, Order, Type))
	Atom a1;
	Atom a2;
	Bond& b1 = *new Bond("name", a1, a2, 1, 2);
	TEST_NOT_EQUAL(&b1, 0)
	TEST_EQUAL(b1.getName(), "name")
	TEST_EQUAL(b1.getFirstAtom(), &a1)
	TEST_EQUAL(b1.getSecondAtom(), &a2)
	TEST_EQUAL(b1.getOrder(), 1)
	TEST_EQUAL(b1.getType(), 2)
	delete &b1;
RESULT

CHECK(createBond(Bond&, Atom&, Atom&))
	Atom a1;
	Atom a2;
	Atom a3;
	Atom a4;
	Atom a5;
	Atom a6;
	Atom a7;
	Atom a8;
	Atom a9;
	Atom a10;
	Bond b1;
	Bond b2;

	TEST_NOT_EQUAL(b1.createBond(b1, a1, a2), 0);
	TEST_EQUAL(a1.countBonds(), 1);
	TEST_EQUAL(a2.countBonds(), 1);
	TEST_EQUAL(b1.getFirstAtom(), &a1);
	TEST_EQUAL(b1.getSecondAtom(), &a2);

	TEST_EQUAL(b2.createBond(b2, a1, a2), &b1);
	TEST_EQUAL(a1.countBonds(), 1);
	TEST_EQUAL(a2.countBonds(), 1);

	TEST_NOT_EQUAL(b2.createBond(b2, a1, a3), 0);
	TEST_EQUAL(a1.countBonds(), 2);
	TEST_EQUAL(a3.countBonds(), 1);

	Bond b3("bond", a1, a4);		
	Bond b4("bond", a1, a5);
	Bond b5("bond", a1, a6);
	Bond b6("bond", a1, a7);
	Bond b7("bond", a1, a8);
	Bond b8("bond", a1, a9);
	Bond b9;
	TEST_EQUAL(b9.createBond(b9, a3, a3), 0);<commit_msg>improved test for createBond(..)<commit_after>// $Id: Bond_test.C,v 1.13 2000/05/31 01:11:45 amoll Exp $
#include <BALL/CONCEPT/classTest.h>

///////////////////////////
#include <BALL/KERNEL/bond.h>
#include <BALL/KERNEL/atom.h>
#include <BALL/COMMON/exception.h>
#include <BALL/CONCEPT/textPersistenceManager.h>
#include <BALL/KERNEL/fragment.h>
#include <BALL/KERNEL/molecule.h>
#include <BALL/KERNEL/system.h>
///////////////////////////

START_TEST(Bond, "$Id: Bond_test.C,v 1.13 2000/05/31 01:11:45 amoll Exp $")

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

using namespace BALL;
String filename;
using std::ofstream;
using std::ios;
using namespace RTTI;
	
Bond*	b;

CHECK(Bond())
	b = new Bond;
	TEST_NOT_EQUAL(b, 0)
RESULT											

CHECK(~Bond())
	delete b;
RESULT

CHECK(Bond(const Bond& bond, bool deep = true))
	Atom a1;
	Atom a2;
	Bond b1, b2;
	b1.setFirstAtom(&a1);
	TEST_EQUAL(b1.getFirstAtom(), &a1);
	b1.setFirstAtom(&a2);
	TEST_EQUAL(b1.getFirstAtom(), &a2);
RESULT		

CHECK(Bond(String&, Atom&, Atom&, Order, Type))
	Atom a1;
	Atom a2;
	Bond& b1 = *new Bond("name", a1, a2, 1, 2);
	TEST_NOT_EQUAL(&b1, 0)
	TEST_EQUAL(b1.getName(), "name")
	TEST_EQUAL(b1.getFirstAtom(), &a1)
	TEST_EQUAL(b1.getSecondAtom(), &a2)
	TEST_EQUAL(b1.getOrder(), 1)
	TEST_EQUAL(b1.getType(), 2)
	delete &b1;
RESULT

CHECK(createBond(Bond&, Atom&, Atom&))
	Atom a1;
	Atom a2;
	Atom a3;
	Atom a4;
	Atom a5;
	Atom a6;
	Atom a7;
	Atom a8;
	Atom a9;
	Atom a10;
	Bond b1;
	Bond b2;

	TEST_NOT_EQUAL(b1.createBond(b1, a2, a1), 0)
	TEST_EQUAL(a2.countBonds(), 1);
	TEST_EQUAL(b1.getFirstAtom(), &a1);
	TEST_EQUAL(b1.getSecondAtom(), &a2);

	TEST_NOT_EQUAL(b1.createBond(b1, a1, a2), 0);
	TEST_EQUAL(a1.countBonds(), 1);
	TEST_EQUAL(a2.countBonds(), 1);
	TEST_EQUAL(b1.getFirstAtom(), &a1);
	TEST_EQUAL(b1.getSecondAtom(), &a2);

	TEST_EQUAL(b2.createBond(b2, a1, a2), &b1);
	TEST_EQUAL(a1.countBonds(), 1);
	TEST_EQUAL(a2.countBonds(), 1);

	TEST_NOT_EQUAL(b2.createBond(b2, a1, a3), 0);
	TEST_EQUAL(a1.countBonds(), 2);
	TEST_EQUAL(a3.countBonds(), 1);

	Bond b3("bond", a1, a4);		
	Bond b4("bond", a1, a5);
	Bond b5("bond", a1, a6);
	Bond b6("bond", a1, a7);
	Bond b7("bond", a1, a8);
	Bond b8("bond", a1, a9);
	Bond b9;
	TEST_EQUAL(b9.createBond(b9, a3, a3), 0);
{'fraction_non_alphanumeric': 0.2483325922632281, 'fraction_numerical': 0.06202756780791463, 'mean_word_length': 3.2725546058879393, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4975996', 'n_tokens_mistral': 2165, 'n_tokens_neox': 2035, 'n_words': 400}