Example #1
0
/*==============================================================================
 * FUNCTION:		ProgTest::testName
 * OVERVIEW:		Test setting and reading name
 *============================================================================*/
void ProgTest::testName ()
{
  BinaryFileFactory bff;
  BinaryFile *pBF = bff.Load(HELLO_PENTIUM);	// Don't actually use it
  Prog* prog = new Prog();
  FrontEnd *pFE = new PentiumFrontEnd(pBF, prog, &bff);
  // We need a Prog object with a pBF (for getEarlyParamExp())
  prog->setFrontEnd(pFE);
  std::string actual(prog->getName());
  std::string expected(HELLO_PENTIUM);
  CPPUNIT_ASSERT_EQUAL(expected, actual);
  std::string name("Happy prog");
  prog->setName(name.c_str());
  actual =  prog->getName();
  CPPUNIT_ASSERT_EQUAL(name, actual);
  delete pFE;
}