27 static boost::gregorian::date
d(2010,8,9);
28 static boost::gregorian::date
dg(2010,12,31);
58 std::cout << std::endl;
59 std::cout <<
" Empty constructor: " << dempty.
toString() << std::endl;
60 std::cout <<
" Date from gregorian date : " << d1.
toString() << std::endl;
61 std::cout <<
" Date from date: " << d2.
toString() << std::endl;
84 CPPUNIT_ASSERT(d2.getYear() == 1400 && d2.getMonth() == 1 && d2.getDay() == 1 );
87 CPPUNIT_ASSERT(d3.getYear() == 9999 && d3.getMonth() == 8 && d3.getDay() == 31 );
88 std::cout << std::endl;
89 std::cout <<
" Testing range of values Year: " << d2.toString() << std::endl;
90 std::cout <<
" Testing range of values Year : " << d3.toString() << std::endl;
95 std::cout <<
" Date from date: " << d4.
toString() << std::endl;
96 CPPUNIT_ASSERT(d4.
getYear() == 0);
98 catch (te::dt::Exception e)
100 std::cout <<
" Year out of range d(0,12,31)" << std::endl;
150 CPPUNIT_ASSERT(d2.operator==(d1));
152 CPPUNIT_ASSERT(static_cast<te::dt::Date*>(d4)->
operator==(d1));
153 CPPUNIT_ASSERT(d2.operator-(d1) == 0);
154 CPPUNIT_ASSERT(d3.operator-(
ds) == 4);
155 CPPUNIT_ASSERT(
de.operator-(
ds) == 364);
156 CPPUNIT_ASSERT(
ds.operator<(
de));
157 CPPUNIT_ASSERT(
de.operator>(
ds));
158 CPPUNIT_ASSERT(
ds.operator!=(
de));
160 std::string d4_show =
static_cast<te::dt::Date*
>(d4)->toString();
161 CPPUNIT_ASSERT(
ds.operator==(*static_cast<te::dt::Date*>(d4)));
163 CPPUNIT_ASSERT(
dmar.operator-(
ds) == 61);
173 CPPUNIT_ASSERT(d.operator==(dclone));
184 CPPUNIT_ASSERT(
ds.operator==(dclone));
185 std::string show = dclone.
toString();
186 CPPUNIT_ASSERT( dclone.
toString() ==
"20100101");
196 std::string empty = dempty.
toString();
197 boost::gregorian::date_duration boostduration(5);
199 std::string sh_dboost = dboost.
toString();
203 CPPUNIT_ASSERT(d.operator==(dclone));
211 CPPUNIT_ASSERT(d3 == d1);
212 CPPUNIT_ASSERT(d < d1);
213 CPPUNIT_ASSERT(d1 > d);
214 CPPUNIT_ASSERT(d != d1);
215 CPPUNIT_ASSERT(d1.
toString() ==
"4");
231 CPPUNIT_ASSERT(pboost.operator==(pclone));
233 std::cout << std::endl;
234 std::cout <<
" Testing DatePeriod class with:" << std::endl;
235 std::cout <<
" DatePeriod p1 : " << p1.
toString() << std::endl;
236 std::cout <<
" DatePeriod pboost: " << pboost.
toString() << std::endl;
237 std::cout <<
" DatePeriod p2 : " << p2.
toString() << std::endl;
238 std::cout <<
" DatePeriod p1plus1:" << p1plus1.
toString() << std::endl;
239 std::cout <<
" DatePeriod p3: " << p3.
toString() << std::endl;
240 std::cout <<
" DatePeriod pboost clone: " << pclone.
toString() << std::endl;
242 std::cout << std::endl;
245 std::cout <<
" DatePeriod: p1 > pboost: " << p1.operator>(pboost) << std::endl;
246 std::cout <<
" DatePeriod: pboost < p1: " << pboost.operator<(p1) << std::endl;
247 std::cout <<
" DatePeriod: p1 != pboost: " << p1.operator!=(pboost) << std::endl;
248 std::cout <<
" DatePeriod: p1 == pboost: " << p1.operator==(pboost) << std::endl;
249 std::cout <<
" DatePeriod: p1 == p3: " << p1.operator==(p3) << std::endl;
257 CPPUNIT_ASSERT(p1.operator>(pboost));
258 CPPUNIT_ASSERT(p1 > pboost);
259 CPPUNIT_ASSERT(pboost.operator<(p1));
260 CPPUNIT_ASSERT(pboost < p1);
261 CPPUNIT_ASSERT(p3.operator==(p1));
262 CPPUNIT_ASSERT(p3 == p1);
std::string toString() const
It returns the date duration in a textual format.
void tcClone()
Test Case: Clone this object and return AbstractData.
void tcToString()
It returns the date in the ISO textual format (YYYYMMDD).
void tcCheckOperators()
Test Case: Check operators (==, >,<, !=, -).
static te::dt::Date dx(2010, 12, 31)
static te::dt::Date de(2010, 12, 31)
void tcDateTimeDuration()
Test Case: Check TimeInstant.
long getSeconds() const
It returns the seconds of a minute - from 0 to 59.
void tcDate()
Test Case: It creates a date time with local date. The date and time are obtained from the system clo...
Date getInitialDate() const
It gets the initial date.
std::string toString() const
It returns the date in the ISO textual format (YYYYMMDD).
boost::gregorian::greg_year getYear() const
It returns the gregorian year.
static te::dt::Date d29(2008, 02, 29)
AbstractData * clone() const
It returns a clone of this object.
boost::gregorian::greg_day getDay() const
It returns the gregorian day - from 1 to 31.
Test suite for the Date class.
static te::dt::Date ds(2010, 01, 01)
static boost::gregorian::date d(2010, 8, 9)
static boost::gregorian::date dg(2010, 12, 31)
A class to represent time instant.
static te::dt::Date d28(2010, 02, 28)
static te::dt::Date dmar(2010, 03, 03)
CPPUNIT_TEST_SUITE_REGISTRATION(TsDate)
Date getDate() const
It returns the date associated to time instant.
AbstractData * clone() const
It returns a clone of this object.
A base class for date data types.
static te::dt::Date di(2010, 06, 10)
static te::dt::TimeDuration dt(20, 30, 50, 11)
A base class for values that can be retrieved from the data access module.
Test suite for the Date, DateDuration and DatePeriod Classes.
void tcDateConstructor()
Test Case: Copy constructor.
A class to represent date duration.
A class to represent time duration with nano-second/micro-second resolution.
TimeDuration getTime() const
It returns the time duration associated to time instant.
const boost::gregorian::date_period & getDatePeriod() const
It returns the boost date period type.
static te::dt::Date d30(2010, 04, 30)
A class to represent date period based on the Gregorian Calendar.
long getMinutes() const
It returns the minutes of a hour - from 0 to 59.
void tcDateCheck()
Test Case: It checks date values (YY,MM,DD)
static te::dt::Date d31(2010, 05, 31)
Date getFinalDate() const
It gets the final date.
boost::gregorian::greg_month getMonth() const
It returns the gregorian month - from 1 to 12.
std::string toString() const
It returns the date period in the ISO textual format (YYYYMMDDTYYYYMMDD).
AbstractData * clone() const
It returns a clone of this object.
long getHours() const
It returns the hours of a day - from 0 to 23.
An exception class for the DataType module.