[Cppunit-cvs] cppunit/examples/qt ExampleTestCases.cpp,NONE,1.1 ExampleTestCases.h,NONE,1.1 qt_examp
Brought to you by:
blep
Update of /cvsroot/cppunit/cppunit/examples/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32369/examples/qt Modified Files: build.bat run.bat Added Files: ExampleTestCases.cpp ExampleTestCases.h qt_example.pro Removed Files: Example.pro ExampleTestCase.cpp ExampleTestCase.h Log Message: * integrated Ernst patch for QtTestRunner and Qt 3.x. * upgrade QtTestRunner to Qt 3.x * enhanced qmake project files to handle multiple build configuration --- Example.pro DELETED --- --- NEW FILE: qt_example.pro --- #---------------------------------------------------------------------- # File: qt_example.pro # Purpose: qmake config file for the QtTestRunner example. # The program is built with the QtTestRunner debug staticlib. # Set the CONFIG variable accordingly to build it differently. #---------------------------------------------------------------------- TEMPLATE = app LANGUAGE = C++ TARGET = qt_example # Get rid of possibly predefined options CONFIG -= debug CONFIG -= release #CONFIG += qt warn_on debug use_static #CONFIG += qt warn_on release use_static #CONFIG += qt warn_on debug use_dll CONFIG += qt warn_on release use_dll #---------------------------------------------------------------------- # MS Windows #---------------------------------------------------------------------- win32 { use_dll { DEFINES += QTTESTRUNNER_DLL debug { OBJECTS_DIR = DebugDLL LIBS += ..\..\lib\cppunitd_dll.lib LIBS += ..\..\lib\qttestrunnerd_dll.lib } release { OBJECTS_DIR = ReleaseDLL LIBS += ..\..\lib\cppunit_dll.lib LIBS += ..\..\lib\qttestrunner_dll.lib } } use_static { debug { OBJECTS_DIR = Debug LIBS += ..\..\lib\cppunitd.lib LIBS += ..\..\lib\qttestrunnerd.lib } release { OBJECTS_DIR = Release LIBS += ..\..\lib\cppunit.lib LIBS += ..\..\lib\qttestrunner.lib } } DESTDIR = $${OBJECTS_DIR} } #---------------------------------------------------------------------- # Linux/Unix #---------------------------------------------------------------------- unix { message("NOT IMPLEMENTED YET!") } #---------------------------------------------------------------------- HEADERS = \ ExampleTestCases.h SOURCES = \ ExampleTestCases.cpp \ Main.cpp INCLUDEPATH += . ../../include Index: build.bat =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/build.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** build.bat 14 Oct 2001 12:23:31 -0000 1.1 --- build.bat 12 Dec 2005 07:40:09 -0000 1.2 *************** *** 1,3 **** ! tmake Example.pro -o Makefile ! nmake clean nmake --- 1,2 ---- ! qmake qt_example.pro nmake --- ExampleTestCase.cpp DELETED --- --- ExampleTestCase.h DELETED --- --- NEW FILE: ExampleTestCases.cpp --- #include "ExampleTestCases.h" CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase ); void ExampleTestCase::example () { CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05); CPPUNIT_ASSERT (1 == 0); CPPUNIT_ASSERT (1 == 1); } void ExampleTestCase::anotherExample () { CPPUNIT_ASSERT (1 == 2); } void ExampleTestCase::setUp () { m_value1 = 2.0; m_value2 = 3.0; } void ExampleTestCase::testAdd () { double result = m_value1 + m_value2; CPPUNIT_ASSERT (result == 6.0); } void ExampleTestCase::testEquals () { std::auto_ptr<long> l1 (new long (12)); std::auto_ptr<long> l2 (new long (12)); CPPUNIT_ASSERT_EQUAL (12, 12); CPPUNIT_ASSERT_EQUAL (12L, 12L); CPPUNIT_ASSERT_EQUAL (*l1, *l2); CPPUNIT_ASSERT (12L == 12L); CPPUNIT_ASSERT_EQUAL (12, 13); CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5); } Index: run.bat =================================================================== RCS file: /cvsroot/cppunit/cppunit/examples/qt/run.bat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** run.bat 14 Oct 2001 12:23:31 -0000 1.1 --- run.bat 12 Dec 2005 07:40:09 -0000 1.2 *************** *** 1,2 **** SET PATH=%PATH%;..\..\lib ! Example.exe \ No newline at end of file --- 1,2 ---- SET PATH=%PATH%;..\..\lib ! Debug\qt_example.exe --- NEW FILE: ExampleTestCases.h --- #ifndef CPP_UNIT_EXAMPLETESTCASE_H #define CPP_UNIT_EXAMPLETESTCASE_H #include <cppunit/TestFixture.h> #include <cppunit/extensions/HelperMacros.h> /* * A test case that is designed to produce * example errors and failures * */ class ExampleTestCase : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE( ExampleTestCase ); CPPUNIT_TEST( example ); CPPUNIT_TEST( anotherExample ); CPPUNIT_TEST( testAdd ); CPPUNIT_TEST( testEquals ); CPPUNIT_TEST_SUITE_END(); protected: double m_value1; double m_value2; public: void setUp (); protected: void example (); void anotherExample (); void testAdd (); void testDivideByZero (); void testEquals (); }; #endif |