imgtools/imgcheck/imagechekunittest/testcode/main.cpp
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <cppunit/BriefTestProgressListener.h>
       
    20 #include <cppunit/CompilerOutputter.h>
       
    21 #include <cppunit/extensions/TestFactoryRegistry.h>
       
    22 #include <cppunit/TestResult.h>
       
    23 #include <cppunit/TestResultCollector.h>
       
    24 #include <cppunit/TestRunner.h>
       
    25 
       
    26 int
       
    27 main( int argc, char* argv[] )
       
    28 {
       
    29 	// Create the event manager and test controller
       
    30 	CPPUNIT_NS::TestResult controller;
       
    31 
       
    32 	// Add a listener that colllects test result
       
    33 	CPPUNIT_NS::TestResultCollector result;
       
    34 	controller.addListener( &result );        
       
    35 
       
    36 	// Add a listener that print dots as test run.
       
    37 	CPPUNIT_NS::BriefTestProgressListener progress;
       
    38 	controller.addListener( &progress );      
       
    39 
       
    40 	// Add the top suite to the test runner
       
    41 	CPPUNIT_NS::TestRunner runner;
       
    42 	runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
       
    43 	runner.run( controller );
       
    44 
       
    45 	// Print test in a compiler compatible format.
       
    46 	CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
       
    47 	outputter.write(); 
       
    48 
       
    49 	return result.wasSuccessful() ? 0 : 1;
       
    50 }
       
    51