Esempio n. 1
0
void ASTTest::testInstances() {
	CPPUNIT_ASSERT(dynamic_cast<AST*>(ast));

	AST* asd = AST::getInstance();
	AST* qwe = AST::getInstance();

	CPPUNIT_ASSERT(asd->contains("Alice"));
	CPPUNIT_ASSERT(qwe->contains("Alice"));

	ProcNode* pn = new ProcNode("Bob");
	StmtLstNode* sln = new StmtLstNode("then");
	pn->linkStmtLstNode(sln);
	asd->addProcNode(pn);

	ProcNode* pget = asd->getProcNode("Bob");
	CPPUNIT_ASSERT(NULL != pget);

	string expname = "Bob";
	CPPUNIT_ASSERT_EQUAL(expname, pget->getName());
	CPPUNIT_ASSERT_EQUAL(pn, pget);

	StmtLstNode* sget = pget->getStmtLstNode();
	CPPUNIT_ASSERT_EQUAL(sln, sget);
	string sname = "then";
	CPPUNIT_ASSERT_EQUAL(sname, sget->getName());

	return;
}
Esempio n. 2
0
void ASTTest::testAcrossMethods() {

	AST* asd = (AST::getInstance());
	CPPUNIT_ASSERT(asd->contains("Alice"));
	CPPUNIT_ASSERT(asd->contains("Bob"));

	ProcNode* pget = asd->getProcNode("Bob");
	CPPUNIT_ASSERT(NULL != pget);

	string expname = "Bob";
	CPPUNIT_ASSERT_EQUAL(expname, pget->getName());
	//CPPUNIT_ASSERT_EQUAL(pn, pget);

	StmtLstNode* sget = pget->getStmtLstNode();
	//CPPUNIT_ASSERT_EQUAL(sln, sget);
	string sname = "then";
	CPPUNIT_ASSERT_EQUAL(sname, sget->getName());

	return;
}