/*
* Project: MoleCuilder
* Description: creates and alters molecular systems
* Copyright (C) 2010-2012 University of Bonn. All rights reserved.
*
*
* This file is part of MoleCuilder.
*
* MoleCuilder is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* MoleCuilder 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 General Public License
* along with MoleCuilder. If not, see .
*/
/*
* WorldTimeUnitTest.cpp
*
* Created on: Oct 29, 2009
* Author: heber
*/
// include config.h
#ifdef HAVE_CONFIG_H
#include
#endif
using namespace std;
#include
#include
#include
#include
#include
#include
#include "CodePatterns/Assert.hpp"
#include "WorldTime.hpp"
#include "WorldTimeUnitTest.hpp"
#ifdef HAVE_TESTRUNNER
#include "UnitTestMain.hpp"
#endif /*HAVE_TESTRUNNER*/
/********************************************** Test classes **************************************/
//!< tremolo's standard time step is 1.0180505e-14 s which is ... in atomictime
const double TremolosTIME = 420.87606;
// Registers the fixture into the 'registry'
CPPUNIT_TEST_SUITE_REGISTRATION( WorldTimeTest );
void WorldTimeTest::setUp()
{
Time = WorldTime::getPointer();
};
void WorldTimeTest::tearDown()
{
WorldTime::purgeInstance();
};
/** Tests whether CurrentTime is accessible
*/
void WorldTimeTest::CurrentTimeTest()
{
// check default is 0
CPPUNIT_ASSERT_EQUAL ((unsigned int)0, Time->getTime() );
// set and check
Time->setTime(10);
CPPUNIT_ASSERT_EQUAL ((unsigned int)10, Time->getTime() );
};
/** Tests whether CurrentTime is accessible
*/
void WorldTimeTest::StepWidthTest()
{
// check default is 0
CPPUNIT_ASSERT_EQUAL (0., Time->getStepWidth() );
// set and check
Time->setStepWidth(TremolosTIME);
CPPUNIT_ASSERT_EQUAL (TremolosTIME, Time->getStepWidth() );
};