[Mockpp-commits] mockpp/mockpp/tests TimeServer_test.cpp,NONE,1.1 Makefile.am,1.73,1.74
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2005-05-06 14:23:23
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27133/mockpp/tests Modified Files: Makefile.am Added Files: TimeServer_test.cpp Log Message: prepare next release --- NEW FILE: TimeServer_test.cpp --- /*************************************************************************** TimeServer_test.cpp - unit tests for *TimeServer classes ------------------- begin : Fri 06 05 2005 copyright : (C) 2002-2005 by Ewald Arnold email : mockpp at ewald-arnold dot de $Id: TimeServer_test.cpp,v 1.1 2005/05/06 14:23:05 ewald-arnold Exp $ ***************************************************************************/ /************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ #include <mockpp/mockpp.h> // always first #ifndef HAVE_CPPUNIT # warning CppUnit not available at compile time #else #include <mockpp/production/TimeServer.h> #include <mockpp/MockTimeServer.h> #include <cppunit/extensions/HelperMacros.h> namespace { class TimeServer_test : public CppUnit::TestFixture { public: CPPUNIT_TEST_SUITE( TimeServer_test ); CPPUNIT_TEST(test_mock); CPPUNIT_TEST(test_real); CPPUNIT_TEST_SUITE_END(); public: void test_real(); void test_mock(); }; CPPUNIT_TEST_SUITE_REGISTRATION(TimeServer_test); void TimeServer_test::test_mock() { mockpp::MockTimeServer rt; rt.addUnixTime(0x1234); rt.addUnixTime(0x5678); mockpp::TimeServer *ts = &rt; std::time_t t1 = ts->getUnixTime(); CPPUNIT_ASSERT_EQUAL((std::time_t)0x1234, t1); t1 = ts->getUnixTime(); CPPUNIT_ASSERT_EQUAL((std::time_t)0x5678, t1); } void TimeServer_test::test_real() { mockpp::RealTimeServer rt; mockpp::TimeServer *ts = &rt; std::time_t t1 = ts->getUnixTime(); std::time_t t2 = std::time(0); CPPUNIT_ASSERT(t1 <= t2); // up to +2s should always succeed CPPUNIT_ASSERT((t1 + 2) >= t2); } } // ns #endif // HAVE_CPPUNIT Index: Makefile.am =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Makefile.am,v retrieving revision 1.73 retrieving revision 1.74 diff -u -d -r1.73 -r1.74 --- Makefile.am 9 Apr 2005 15:31:42 -0000 1.73 +++ Makefile.am 6 May 2005 14:23:05 -0000 1.74 @@ -29,17 +29,18 @@ mock_test_SOURCES = mock_test.cpp VisitableMockObject_test.cpp \ - Formatter_test.cpp Throwable_test.cpp ThrowableList_test.cpp ExpectationCounter_test.cpp \ - ExpectationCounterRange_test.cpp ExpectationMap_test.cpp ExpectationList_test.cpp ConstraintList_test.cpp \ - ExpectationSet_test.cpp ExpectationConglomeration_test.cpp ExpectationSegment_test.cpp \ - ExpectationValue_test.cpp ExpectationBoundary_test.cpp Verifiable_test.cpp Exception_test.cpp \ - mockpp_test.cpp ReturnObjectList_test.cpp VisitableMockObject_template_test.cpp \ - Assert_test.cpp AssertMo_test.cpp MockObject_test.cpp VisitableMockObject_1_test.cpp \ - VisitableMockObject_2_test.cpp VisitableMockObject_3_test.cpp VisitableMockObject_4_test.cpp \ - VisitableMockObject_5_test.cpp VisitableMockObject_void_test.cpp VisitableMockObject_1_void_test.cpp \ - VisitableMockObject_2_void_test.cpp VisitableMockObject_3_void_test.cpp VisitableMockObject_4_void_test.cpp \ - VisitableMockObject_5_void_test.cpp VerifyingTestCase_test.cpp classes_ABCDE.cpp \ - VerifyingTestCaller_test.cpp TrackingCounter_test.cpp MixedMockObject_5_test.cpp + Formatter_test.cpp Throwable_test.cpp ThrowableList_test.cpp ExpectationCounter_test.cpp \ + ExpectationCounterRange_test.cpp ExpectationMap_test.cpp ExpectationList_test.cpp \ + ConstraintList_test.cpp ExpectationSet_test.cpp ExpectationConglomeration_test.cpp \ + ExpectationSegment_test.cpp ExpectationValue_test.cpp ExpectationBoundary_test.cpp \ + Verifiable_test.cpp Exception_test.cpp mockpp_test.cpp ReturnObjectList_test.cpp \ + VisitableMockObject_template_test.cpp Assert_test.cpp AssertMo_test.cpp MockObject_test.cpp \ + VisitableMockObject_1_test.cpp VisitableMockObject_2_test.cpp VisitableMockObject_3_test.cpp \ + VisitableMockObject_4_test.cpp VisitableMockObject_5_test.cpp VisitableMockObject_void_test.cpp \ + VisitableMockObject_1_void_test.cpp VisitableMockObject_2_void_test.cpp \ + VisitableMockObject_3_void_test.cpp VisitableMockObject_4_void_test.cpp \ + VisitableMockObject_5_void_test.cpp VerifyingTestCase_test.cpp classes_ABCDE.cpp \ + VerifyingTestCaller_test.cpp TrackingCounter_test.cpp MixedMockObject_5_test.cpp TimeServer_test.cpp mock_test_count: list=mock_test.files; \ |