26 static boost::gregorian::date
d(2010,8,9);
27 static boost::posix_time::ptime
bt;
50 std::cout << std::endl;
51 std::cout <<
" print tt: " << tt.
toString() << std::endl;
53 std::cout <<
" print tt after assign: " << tt.
toString() << std::endl;
54 CPPUNIT_ASSERT( tt.
toString() ==
"20100101T203050.000011");
79 CPPUNIT_ASSERT(
bt.getDate().getYear() == 2010 &&
bt.getDate().getMonth() == 1 &&
bt.getDate().getDay() == 1 );
80 CPPUNIT_ASSERT(
bt.getTime().getHours() == 20 &&
bt.getTime().getMinutes() == 30 &&
bt.getTime().getSeconds() == 50 &&
bt.getTime().getFractionalSeconds() == 11) ;
115 CPPUNIT_ASSERT(tt1.getTime().getHours() == 23 && tt1.getTime().getMinutes() == 59 && tt1.getTime().getSeconds() == 59 && tt1.getTime().getFractionalSeconds() == 0) ;
133 std::cout << std::endl;
134 std::cout <<
" tt1: " << tt1.
toString() << std::endl;
135 std::cout <<
" tt2: " << tt2.
toString() << std::endl;
136 std::cout <<
" tt3: " << tt3.
toString() << std::endl;
138 CPPUNIT_ASSERT(tt1.operator==(tt));
141 CPPUNIT_ASSERT(tt2.operator-(tt1) != 0);
143 CPPUNIT_ASSERT(tt3.operator-(tt2) == 9);
145 CPPUNIT_ASSERT(tt1 < tt2);
146 CPPUNIT_ASSERT(tt1.operator<(tt2));
148 CPPUNIT_ASSERT(tt2 > tt1);
149 CPPUNIT_ASSERT(tt2.operator>(tt1));
151 CPPUNIT_ASSERT(tt2 != tt1);
152 CPPUNIT_ASSERT(tt2.operator!=(tt1));
154 CPPUNIT_ASSERT( tt1.toString() ==
"20100101T203050.000011");
155 CPPUNIT_ASSERT( tt2.
toString() ==
"20101231T203050.000011");
156 CPPUNIT_ASSERT( tt3.
toString() ==
"20101231T203059.000011");
168 CPPUNIT_ASSERT(tt.operator==(tclone));
180 CPPUNIT_ASSERT(tt.operator==(tclone));
181 std::string show = tclone.
toString();
182 CPPUNIT_ASSERT( tclone.
toString() ==
"20100101T203050.000011");
static te::dt::TimeDuration td(20, 30, 50, 11)
static boost::posix_time::ptime bt
void tcTimeInstant()
Test Case: Empty Constructor.
Test suite for the TimeInstant class.
long getSeconds() const
It returns the seconds of a minute - from 0 to 59.
static te::dt::TimeDuration td1(23, 59, 59)
boost::gregorian::greg_year getYear() const
It returns the gregorian year.
boost::gregorian::greg_day getDay() const
It returns the gregorian day - from 1 to 31.
static te::dt::TimeInstant TT(ds, td)
std::string toString() const
It returns the time instant in the ISO textual format (YYYYMMDDTHHMMSS,fffffffff) where T is the date...
void tcTimeInstant2()
Test Case: Constructor from a date and time offset.
void tcCheckOperators()
Test Case: Check operators (==, >,<, !=, -).
const boost::posix_time::ptime & getTimeInstant() const
It returns the boost time instant type.
A class to represent time instant.
AbstractData * clone() const
It returns a clone of this object.
Date getDate() const
It returns the date associated to time instant.
A base class for date data types.
Test suite for the TimeInstant Class.
CPPUNIT_TEST_SUITE_REGISTRATION(TsTimeInstant)
boost::int64_t getFractionalSeconds() const
It returns the fractional seconds.
void tcToString()
It returns the time instant in the ISO textual format (YYYYMMDDTHHMMSS,fffffffff) where T is the date...
static te::dt::Date ds(2010, 01, 01)
void tcGetDate()
Test Case: It returns the date associated to time instant.
void tcTimeInstant3()
Test Case: Constructor from a boost time instant type.
static te::dt::Date de(2010, 12, 31)
A class to represent time duration with nano-second/micro-second resolution.
TimeDuration getTime() const
It returns the time duration associated to time instant.
long getMinutes() const
It returns the minutes of a hour - from 0 to 59.
void tcGetTime()
Test Case:It returns the time duration associated to time instant.
void tcGetTimeInstant()
Test Case: It returns the boost time instant type.
boost::gregorian::greg_month getMonth() const
It returns the gregorian month - from 1 to 12.
long getHours() const
It returns the hours of a day - from 0 to 23.
void tcClone()
Test Case: Clone this object and return AbstractData.
static boost::gregorian::date d(2010, 8, 9)