CPPUnit 1.12.1 库源码包和文档


鼎鼎大名的XUnit系列C++方面产品库. 开源的单元测试框架. 算半自动化吧. 只是提供了一个框架. 没听过CPPUnit? JUnit听过吧? 还是没听过? 那我怀疑你根本不知道什么是单元测试.
资源截图
代码片段和文件信息
// //////////////////////////////////////////////////////////////////////////
// Implementation file ClockerListener.cpp for class ClockerListener
// (c)Copyright 2000 Baptiste Lepilleur.
// Created: 2002/04/19
// //////////////////////////////////////////////////////////////////////////
#include 
#include 
#include “ClockerListener.h“
#include “ClockerModel.h“
#include 


ClockerListener::ClockerListener( ClockerModel *model
                                  bool text )
    : m_model( model )
     m_text( text )
{
}


ClockerListener::~ClockerListener()
{
}


void 
ClockerListener::startTestRun( CPPUNIT_NS::Test *test 
                               CPPUNIT_NS::TestResult *eventManager )
{
  m_model->setExpectedTestCount( test->countTestCases() *2 );
}


void 
ClockerListener::endTestRun( CPPUNIT_NS::Test *test 
                             CPPUNIT_NS::TestResult *eventManager )
{
  if ( m_text )
    printStatistics();
}


void 
ClockerListener::startTest( CPPUNIT_NS::Test *test )
{
  m_model->enterTest( test false );
}


void 
ClockerListener::endTest( CPPUNIT_NS::Test *test )
{
  m_model->exitTest( test false );
}


void 
ClockerListener::startSuite( CPPUNIT_NS::Test *suite )
{
  m_model->enterTest( suite true );
}


void 
ClockerListener::endSuite( CPPUNIT_NS::Test *suite )
{
  m_model->exitTest( suite true );
}


void 
ClockerListener::printStatistics() const
{
  printTest( 0 ““ );
  CPPUNIT_NS::stdCOut()  <<  “
“;
  CPPUNIT_NS::stdCOut()  <<  “Total elapsed time: “;
  printTime( m_model->totalElapsedTime() );
  CPPUNIT_NS::stdCOut()  <<  “ average test case time: “;
  printTime( m_model->averageTestCaseTime() );
}


void 
ClockerListener::printTest( int testIndex
                            const std::string &indentString ) const
{
  std::string indent = indentString;
  const int indentLength = 3;

  printTestIndent( indentString indentLength );
  printTime( m_model->testTimeFor( testIndex ) );

  CPPUNIT_NS::stdCOut()  <<  m_model->testPathFor( testIndex ).getChildTest()->getName();
  CPPUNIT_NS::stdCOut()  <<  “
“;

  if ( m_model->childCountFor( testIndex ) == 0 )
    indent+= std::string( indentLength ‘ ‘ );
  else
    indent+= “|“ + std::string( indentLength -1 ‘ ‘ );

  for ( int index =0; index < m_model->childCountFor( testIndex ); ++index )
    printTest( m_model->childAtFor( testIndex index ) indent );
}


void 
ClockerListener::printTestIndent( const std::string &indent
                                  const int indentLength ) const
{
  if ( indent.empty() )
    return;

  CPPUNIT_NS::stdCOut() << “   “;
  CPPUNIT_NS::stdCOut() << indent.substr( 0 indent.length() - indentLength ) ;
  CPPUNIT_NS::stdCOut() << “+“  <<  std::string( indentLength -1 ‘-‘ );
}


void 
ClockerListener::printTime( double time ) const
{
  CPPUNIT_NS::stdCOut() <<  ‘(‘  <<  ClockerModel::timeStringFor( time )  <<  “s) “;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     271151  2008-02-20 13:59  cppunit-1.12.1aclocal.m4

     文件        286  2002-09-23 13:43  cppunit-1.12.1AUTHORS

     文件        129  2003-06-05 14:18  cppunit-1.12.1BUGS

     文件     134056  2008-02-07 16:46  cppunit-1.12.1ChangeLog

     文件       2249  2002-09-17 02:35  cppunit-1.12.1CodingGuideLines.txt

     文件       5056  2001-06-17 23:47  cppunit-1.12.1configac_create_prefix_config_h.m4

     文件        739  2001-07-08 00:05  cppunit-1.12.1configac_cxx_have_sstream.m4

     文件        837  2001-09-20 12:18  cppunit-1.12.1configac_cxx_have_strstream.m4

     文件        717  2001-06-03 07:26  cppunit-1.12.1configac_cxx_namespaces.m4

     文件        998  2001-06-03 06:29  cppunit-1.12.1configac_cxx_rtti.m4

     文件        907  2001-06-03 07:26  cppunit-1.12.1configac_cxx_string_compare_string_first.m4

     文件       1253  2003-05-08 04:07  cppunit-1.12.1configac_dll.m4

     文件       1117  2004-02-19 04:45  cppunit-1.12.1configax_cxx_gcc_abi_demangle.m4

     文件        731  2007-01-27 12:19  cppunit-1.12.1configax_cxx_have_isfinite.m4

     文件       1274  2007-01-12 12:24  cppunit-1.12.1configb_enable_doxygen.m4

     文件      44892  2008-02-18 04:10  cppunit-1.12.1configconfig.guess

     文件       2621  2008-02-20 14:04  cppunit-1.12.1configconfig.h.in

     文件      33387  2008-02-18 04:10  cppunit-1.12.1configconfig.sub

     文件      17867  2008-02-10 10:55  cppunit-1.12.1configdepcomp

     文件      13620  2008-02-10 10:55  cppunit-1.12.1configinstall-sh

     文件     199984  2008-02-02 21:28  cppunit-1.12.1configltmain.sh

     文件      11135  2008-02-10 10:55  cppunit-1.12.1configmissing

     文件     750156  2008-02-20 13:59  cppunit-1.12.1configure

     文件       4307  2008-02-20 13:59  cppunit-1.12.1configure.in

     文件       4359  2002-04-21 20:32  cppunit-1.12.1contribc5cc-makefile.zip

     文件       5147  2008-02-20 14:04  cppunit-1.12.1contribmsvcAddingUnitTestMethod.dsm

     文件      11405  2008-02-20 14:04  cppunit-1.12.1contribmsvcCppUnit.WWTpl

     文件        462  2008-02-20 14:04  cppunit-1.12.1contribmsvc
eadme.txt

     文件       3925  2006-03-05 04:58  cppunit-1.12.1contribxml-xsl
eport.xsl

     文件       1960  2002-04-18 17:58  cppunit-1.12.1contribxml-xsl ests.xml

............此处省略1079个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)