Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SuiteTestMain.cc

Go to the documentation of this file.
00001 
00002 
00003 #include <iostream>
00004 #include <sstream>
00005 #include <complex>
00006 #include "TestSuite.hh"
00007 #include "SuiteTest.hh"
00008 
00009 int debug_level = 10;
00010 int version_flag;
00011 
00012 int
00013 main()
00014 {
00015   ccunit::TestSuite *s = new ccunit::TestSuite("Suite Test");
00016     
00017   // Use null stream:
00018   s->Add(ccunit::TestComponentPtr(new ComplexTest));
00019   s->Add(ccunit::TestComponentPtr(new VoidTest));
00020 
00021   // All we need to do is print the output
00022   cout << *s << endl;
00023 
00024   cout << "fails == " << s->getNumFailed() << " (should be 1)\n\n";
00025 
00026   // Test addSuite; use a string stream
00027   ccunit::TestSuite s2(s->getName());
00028   ostringstream os;
00029 
00030   s2.Add(ccunit::TestComponentPtr(s));
00031 
00032   // All we need to do is print the output
00033   os << s2;
00034 
00035   cout << "Total Passes: " << s2.getNumPassed()
00036        << " (should be 3)\n";
00037   cout << "Total failures: " << s2.getNumFailed() << " (should be 1)\n";
00038   cout << os.str();
00039   cout << endl;
00040 }
00041 
00042 /* Output:
00043 Caught bad addTest
00044 fails == 1 (should be 1)
00045 
00046 Total Passes: 3 (should be 3)
00047 Total failures: 1 (should be 1)
00048 Failed:: complex: (*m_c1 + *m_c2 != *m_c3) , c:\reuse\testsuite\test\main.cpp (line 42)
00049 Suite "Suite Test"
00050 ==================
00051 Test "complex":
00052     Passed: 2    Failed: 1
00053 Test "void":
00054     Passed: 1    Failed: 0
00055 ==================
00056 
00057 Stream operator test:
00058 
00059 Suite "Suite Test"
00060 ==================
00061 Test "complex":
00062     Passed: 2    Failed: 1
00063 Test "void":
00064     Passed: 1    Failed: 0
00065 ==================
00066 */
00067 

Generated on Tue Apr 2 15:33:22 2002 for libccunit by doxygen 1.2.14 written by Dimitri van Heesch, © 1997-2002

Project hosted on sourceforge SourceForge Logo