[grisbi-cvs] grisbi/src utils_dates_cunit.c,1.2,1.3

Mickaƫl Remars mykeul at users.sourceforge.net
Sun May 24 10:59:59 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13405

Modified Files:
	utils_dates_cunit.c 
Log Message:
Reworked tests on gsb_parse_date_string() to properly check for invalid dates, and let tests passing on Linux

Index: utils_dates_cunit.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/utils_dates_cunit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- utils_dates_cunit.c	21 May 2009 21:58:55 -0000	1.2
+++ utils_dates_cunit.c	24 May 2009 08:59:57 -0000	1.3
@@ -64,10 +64,7 @@
 {
     GDate *date = NULL;
     // invalid day
-    date = gsb_parse_date_string ( "00/02/2009" );
-    CU_ASSERT_EQUAL(G_DATE_BAD_YEAR, g_date_get_year(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_MONTH, g_date_get_month(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_DAY, g_date_get_day(date));
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "00/02/2009" ) );
 
     date = gsb_parse_date_string ( "01/02/2009" );
     CU_ASSERT_EQUAL(2009, g_date_get_year(date));
@@ -75,16 +72,10 @@
     CU_ASSERT_EQUAL(1, g_date_get_day(date));
 
     // invalid day
-    date = gsb_parse_date_string ( "30/02/2009" );
-    CU_ASSERT_EQUAL(G_DATE_BAD_YEAR, g_date_get_year(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_MONTH, g_date_get_month(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_DAY, g_date_get_day(date));
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "30/02/2009" ) );
 
     // 2009 is not a leap year
-    date = gsb_parse_date_string ( "29/02/2009" );
-    CU_ASSERT_EQUAL(G_DATE_BAD_YEAR, g_date_get_year(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_MONTH, g_date_get_month(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_DAY, g_date_get_day(date));
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "29/02/2009" ) );
 
     // 2008 was a leap year
     date = gsb_parse_date_string ( "29/02/2008" );
@@ -103,16 +94,10 @@
     CU_ASSERT_EQUAL(31, g_date_get_day(date));
 
     // invalid day
-    date = gsb_parse_date_string ( "32/12/2009" );
-    CU_ASSERT_EQUAL(G_DATE_BAD_YEAR, g_date_get_year(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_MONTH, g_date_get_month(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_DAY, g_date_get_day(date));
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "32/12/2009" ) );
 
     // invalid month
-    date = gsb_parse_date_string ( "13/13/2009" );
-    CU_ASSERT_EQUAL(G_DATE_BAD_YEAR, g_date_get_year(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_MONTH, g_date_get_month(date));
-    CU_ASSERT_EQUAL(G_DATE_BAD_DAY, g_date_get_day(date));
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "13/13/2009" ) );
 }
 
 CU_pSuite utils_dates_cunit_create_suite ( void )



More information about the cvs mailing list