[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_9_3-11-g9f0b4f4

Philippe Delorme nobody at users.sourceforge.net
Sat Aug 27 00:24:09 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  9f0b4f44b2994747cd5434534a6ffd40ec96be4f (commit)
      from  f91d5e979f64c587b53b43b1a6cc41a8a50a79c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9f0b4f44b2994747cd5434534a6ffd40ec96be4f
Author: Philippe Delorme <philippedelorme at users.sourceforge.net>
Date:   Fri Aug 26 23:23:55 2011 +0200

    Add more diversity to date string tests

-----------------------------------------------------------------------

Changes:
diff --git a/src/tests/utils_dates_cunit.c b/src/tests/utils_dates_cunit.c
index f09d431..f6243b3 100644
--- a/src/tests/utils_dates_cunit.c
+++ b/src/tests/utils_dates_cunit.c
@@ -91,19 +91,26 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
     CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "02/29/2009" ) );
 
     /* 2008 was a leap year */
-    date = gsb_parse_date_string ( "02/29/2008" );
+    date = gsb_parse_date_string ( "02:29:2008" );
     CU_ASSERT_EQUAL(2008, g_date_get_year(date));
     CU_ASSERT_EQUAL(2, g_date_get_month(date));
     CU_ASSERT_EQUAL(29, g_date_get_day(date));
     g_date_free( date );
 
-    date = gsb_parse_date_string ( "02/28/2009" );
+    date = gsb_parse_date_string ( "02-28-2009" );
     CU_ASSERT_EQUAL(2009, g_date_get_year(date));
     CU_ASSERT_EQUAL(2, g_date_get_month(date));
     CU_ASSERT_EQUAL(28, g_date_get_day(date));
     g_date_free( date );
 
-    date = gsb_parse_date_string ( "12/31/2009" );
+    date = gsb_parse_date_string ( "12312009" );
+    CU_ASSERT_EQUAL(2009, g_date_get_year(date));
+    CU_ASSERT_EQUAL(12, g_date_get_month(date));
+    CU_ASSERT_EQUAL(31, g_date_get_day(date));
+    g_date_free( date );
+
+    /* implicit year */
+    date = gsb_parse_date_string ( "12/31/09" );
     CU_ASSERT_EQUAL(2009, g_date_get_year(date));
     CU_ASSERT_EQUAL(12, g_date_get_month(date));
     CU_ASSERT_EQUAL(31, g_date_get_day(date));
@@ -143,18 +150,25 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
     CU_ASSERT_EQUAL(29, g_date_get_day(date));
     g_date_free( date );
 
-    date = gsb_parse_date_string ( "28/02/2009" );
+    date = gsb_parse_date_string ( "28.02.2009" );
     CU_ASSERT_EQUAL(2009, g_date_get_year(date));
     CU_ASSERT_EQUAL(2, g_date_get_month(date));
     CU_ASSERT_EQUAL(28, g_date_get_day(date));
     g_date_free( date );
 
-    date = gsb_parse_date_string ( "31/12/2009" );
+    date = gsb_parse_date_string ( "31122009" );
     CU_ASSERT_EQUAL(2009, g_date_get_year(date));
     CU_ASSERT_EQUAL(12, g_date_get_month(date));
     CU_ASSERT_EQUAL(31, g_date_get_day(date));
     g_date_free( date );
 
+    /* implicit year */
+    date = gsb_parse_date_string ( "010209" );
+    CU_ASSERT_EQUAL(2009, g_date_get_year(date));
+    CU_ASSERT_EQUAL(2, g_date_get_month(date));
+    CU_ASSERT_EQUAL(1, g_date_get_day(date));
+    g_date_free( date );
+
     /* invalid day */
     CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "32/12/2009" ) );
 
@@ -167,18 +181,15 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
     /* invalid day */
     CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "02/00/2009" ) );
 
-    date = gsb_parse_date_string ( "02/01/2009" );
-    CU_ASSERT_EQUAL(2009, g_date_get_year(date));
-    CU_ASSERT_EQUAL(2, g_date_get_month(date));
-    CU_ASSERT_EQUAL(1, g_date_get_day(date));
-    g_date_free( date );
-
     /* invalid day */
     CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "02/30/2009" ) );
 
     /* 2009 is not a leap year */
     CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "02/29/2009" ) );
 
+    /* 209 is not a valid year */
+    CU_ASSERT_EQUAL ( NULL, gsb_parse_date_string ( "02/29/209" ) );
+
     /* 2008 was a leap year */
     date = gsb_parse_date_string ( "02/29/2008" );
     CU_ASSERT_EQUAL(2008, g_date_get_year(date));
@@ -206,6 +217,20 @@ void utils_dates_cunit__gsb_parse_date_string ( void )
 
 
     /**
+     * short date tests
+     */
+    gsb_date_set_format_date ( "%d/%m/%Y" );
+
+    date = gsb_parse_date_string ( "1" );
+    CU_ASSERT_EQUAL(1, g_date_get_day(date));
+    g_date_free( date );
+
+    date = gsb_parse_date_string ( "10" );
+    CU_ASSERT_EQUAL(10, g_date_get_day(date));
+    g_date_free( date );
+
+
+    /**
      * tear down
      */
     gsb_date_set_format_date ( NULL );


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list