????3??????GUI??????MFC???????
????????????????????ó???
????Step1:  ????????????????InitInstance()?????????′???

 

/*      CdialogCppUnitDlgdlg;
m_pMainWnd =&dlg;
INT_PTRnResponse = dlg.DoModal();
if (nResponse== IDOK)
{
// TODO: ?????????????
//  “???”?????????????
}
else if (nResponse== IDCANCEL)
{
// TODO: ?????????????
//  “???”?????????????
}
*/

??????д?????????

 

CppUnit::MfcUi::TestRunner runner;
runner.addTest(PlusTest::suite());//??????
runner.run();//showui

????Step2:??д?????????????????£?

 

PlusTestCase.h
#pragma once
#include "cppunit/TestCase.h"
#include "cppunit/extensions/HelperMacros.h"
class CPlusTestCase :public CppUnit::TestCase
{
//???????TestSuite
CPPUNIT_TEST_SUITE(CPlusTestCase);
//????????????TestSuite???????μ????????????????????????
//CPPUNIT_TEST(testSort);
CPPUNIT_TEST(testAdd);
//TestSuite???????
CPPUNIT_TEST_SUITE_END();
public:
CPlusTestCase(void);
~CPlusTestCase(void);
voidtestAdd();//???????
//voidtestSort();//??????????
void setUp();
voidtearDown();
};
PlusTestCase.cpp
#include "StdAfx.h"
#include "PlusTestCase.h"
#include "../dllMfcDlg/CPlus.h"  //20130327
//#include "../intSort/CCSort.h"  //20130327
#pragma comment (lib?? "cppunitd_dll.lib")
#pragma comment(lib??"E:\workStudyDocu\CppUnit\2008cppunit-lib-dll_32\testrunnerud.lib")
#pragma comment (lib??"E:\workStudyDocu\CppUnit\2008cppunit-lib-dll_32\cppunitd.lib")
//#pragma comment(lib??"E:\workStudyDocu\CppUnit\2008cppunit-lib-dll_32\testrunnerd.lib")
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CPlusTestCase??"plus");//?????????plus??TestSuite
//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CPlusTestCase??"sort");
CPlusTestCase::CPlusTestCase(void)
{
}
CPlusTestCase::~CPlusTestCase(void)
{
}
void CPlusTestCase::testAdd()
{
CCPlusplus;//??????????
int nret =plus.Add(10??20);
CPPUNIT_ASSERT_EQUAL(30??nret);
}
void CPlusTestCase::setUp()
{
}
void CPlusTestCase::tearDown()
{
}