summaryrefslogtreecommitdiff
path: root/src/tests/xb_test_date.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/xb_test_date.cpp')
-rwxr-xr-xsrc/tests/xb_test_date.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/tests/xb_test_date.cpp b/src/tests/xb_test_date.cpp
index 7aee584..0efe102 100755
--- a/src/tests/xb_test_date.cpp
+++ b/src/tests/xb_test_date.cpp
@@ -69,6 +69,8 @@ int main( int argCnt, char **av )
iRc += TestMethod( po, "FormatDate( '', sOutDate ) (sys default format)", d3.FormatDate( sFmt, sOutDate ), 0 );
iRc += TestMethod( po, "FormatDate( '', sOutDate ) (sys default format)", sOutDate, "07/09/12", 8 );
+
+
iRc += TestMethod( po, "CenturyOf()" , d3.CenturyOf(), 20 );
iRc += TestMethod( po, "YearOf()", d3.YearOf(), 2012 );
iRc += TestMethod( po, "MonthOf()", d3.MonthOf(), 7 );
@@ -84,12 +86,11 @@ int main( int argCnt, char **av )
d1.Set( "20010102" );
iRc += TestMethod( po, "d1.Set('20010102')", d1.Str(), "20010102", 8 );
- iRc += TestMethod( po, "d1.CalcRollingCenturyForYear(10)", d1.CalcRollingCenturyForYear( 10 ), 20 );
+ iRc += TestMethod( po, "d1.CalcRollingCenturyForYear(10)", d1.CalcRollingCenturyForYear( 10 ), 20 );
iRc += TestMethod( po, "d1.JulianDays()", d1.JulianDays(), 2451912 );
-
-
iRc += TestMethod( po, "d1.Set( '20140709' )", d1.Set( "20140709" ) , 0 );
+
d1.CharDayOf( s );
iRc += TestMethod( po, "d1.CharDayOf(s)", s, "Wednesday", 9 );
@@ -135,8 +136,8 @@ int main( int argCnt, char **av )
iRc+= TestMethod( po, "d1+2", d1+2, "20130407", 8 );
iRc+= TestMethod( po, "d1-5", d1-5, "20130402", 8 );
-// d1.Dump( "d1" );
-// d2.Dump( "d2" );
+ //d1.Dump( "d1" );
+ //d2.Dump( "d2" );
iRc+= TestMethod( po, "d1==d2", d1==d2, 0 );
d2 = d1;
@@ -159,6 +160,29 @@ int main( int argCnt, char **av )
iRc+= TestMethod( po, "d1<=d2", d1<=d2, 0 );
iRc+= TestMethod( po, "d1-d2", d1-d2, 1 );
+
+ // null date testing follows
+ iRc+= TestMethod( po, "IsNull", d1.IsNull(), xbFalse );
+ xbDate dN;
+ iRc+= TestMethod( po, "IsNull", dN.IsNull(), xbTrue );
+
+ xbDate dtNull1;
+ xbDate dtNull2;
+
+ iRc+= TestMethod( po, "dtNull1==dtNull2", dtNull1 == dtNull2, 1 );
+ iRc+= TestMethod( po, "dtNull1!=dtNull2", dtNull1 != dtNull2, 0 );
+
+ iRc+= TestMethod( po, "dtNull1 < d2", dtNull1 < d2, 1 );
+ iRc+= TestMethod( po, "dtNull1 > d2", dtNull1 > d2, 0 );
+ iRc+= TestMethod( po, "dtNull1 <= d2", dtNull1 <= d2, 1 );
+ iRc+= TestMethod( po, "dtNull1 >= d2", dtNull1 >= d2, 0 );
+
+ iRc+= TestMethod( po, "d2 < dtNull1", d2 < dtNull1, 0 );
+ iRc+= TestMethod( po, "d2 > dtNull1", d2 > dtNull1, 1 );
+ iRc+= TestMethod( po, "d2 <= dtNull1", d2 <= dtNull1, 0 );
+ iRc+= TestMethod( po, "d2 >= dtNull1", d2 >= dtNull1, 1 );
+
+
/*
xbDate d4( "20171015" );
std::cout << "day of [" << d4.Str() << "][" << d4.DayOf( XB_FMT_WEEK ) << "]\n";