gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Wed Jan 20 15:16:00 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/bb915dc8 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d6e6eb64 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1a65e716 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1da2eacf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/88495d23 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/df551196 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c59d1a22 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6b9823c6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/985bf549 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ae40a4c6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2763b485 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8fba6e21 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/598531f7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/afff8102 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8168f45a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/25542415 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/bd59bab2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/24773aa2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/00104588 (commit)



commit bb915dc8f1b143c59ba6bf043f67b59f914b2814
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Jan 20 20:54:46 2016 +0100

    csv-imp - add parse test for semicolon separated strings

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index ffa27c8..451b774 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -58,6 +58,13 @@ static parse_test_data comma_separated [] = {
         { NULL, 0, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } },
 };
 
+static parse_test_data semicolon_separated [] = {
+        { "Date;Num;Description;Notes;Account;Deposit;Withdrawal;Balance", 8, { "Date","Num","Description","Notes","Account","Deposit","Withdrawal","Balance" } },
+        { "05/01/15;45;Acme Inc.;;Miscellaneous;;\"1,100.00\";", 8, { "05/01/15","45","Acme Inc.","","Miscellaneous","","1,100.00","" } },
+        { "05/01/15;45;Acme Inc.;;Miscellaneous;", 4, { "05/01/15","45","Acme Inc.","",NULL,NULL,NULL,NULL } },
+        { NULL, 0, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } },
+};
+
 static char* get_filepath(const char* filename, gboolean test_existence)
 {
     char *result;
@@ -385,6 +392,18 @@ test_gnc_csv_parse_comma_sep (Fixture *fixture, gconstpointer pData)
     test_gnc_csv_parse_helper (fixture->parse_data, pData);
 }
 
+static void
+test_gnc_csv_parse_semicolon_sep (Fixture *fixture, gconstpointer pData)
+{
+    GSList* sep_list = NULL;
+
+    sep_list = g_slist_append (sep_list, ";");
+    stf_parse_options_csv_set_separators (fixture->parse_data->options, NULL, sep_list);
+    g_slist_free (sep_list);
+
+    test_gnc_csv_parse_helper (fixture->parse_data, pData);
+}
+
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0
 */
@@ -431,6 +450,7 @@ GNC_TEST_ADD_FUNC (suitename, "gnc csv new parse data", test_gnc_csv_new_parse_d
 GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
 GNC_TEST_ADD (suitename, "gnc csv parse from file", Fixture, samplefile1, setup_one_file, test_gnc_csv_parse_from_file, teardown);
 GNC_TEST_ADD (suitename, "parse comma", Fixture, comma_separated, setup, test_gnc_csv_parse_comma_sep, teardown);
+GNC_TEST_ADD (suitename, "parse semicolon", Fixture, semicolon_separated, setup, test_gnc_csv_parse_semicolon_sep, teardown);
 // GNC_TEST_ADD (suitename, "trans property free", Fixture, NULL, setup, test_trans_property_free, teardown);
 // GNC_TEST_ADD (suitename, "trans property set", Fixture, NULL, setup, test_trans_property_set, teardown);
 // GNC_TEST_ADD (suitename, "trans property list free", Fixture, NULL, setup, test_trans_property_list_free, teardown);

commit d6e6eb6401b0847a75ca915b97d565dc1353ab58
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Jan 20 20:29:24 2016 +0100

    csv-imp - new parse test starting from an in-source string struct
    
    This test reads its test data from a struct in the test source
    instead of from a real csv file.
    This allows to keep the string to parse and
    the expected parsed fields in one struct for evaluation.

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index 4ab6f5b..ffa27c8 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -42,8 +42,22 @@ typedef struct
     int          exp_day;
 } parse_date_data;
 
+typedef struct
+{
+    const gchar *csv_line;
+    int          num_fields;
+    const gchar *fields [8];
+} parse_test_data;
+
 static const gchar* samplefile1 = "sample1.csv";
 
+static parse_test_data comma_separated [] = {
+        { "Date,Num,Description,Notes,Account,Deposit,Withdrawal,Balance", 8, { "Date","Num","Description","Notes","Account","Deposit","Withdrawal","Balance" } },
+        { "05/01/15,45,Acme Inc.,,Miscellaneous,,\"1,100.00\",", 8, { "05/01/15","45","Acme Inc.","","Miscellaneous","","1,100.00","" } },
+        { "05/01/15,45,Acme Inc.,,Miscellaneous,", 4, { "05/01/15","45","Acme Inc.","",NULL,NULL,NULL,NULL } },
+        { NULL, 0, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } },
+};
+
 static char* get_filepath(const char* filename, gboolean test_existence)
 {
     char *result;
@@ -267,6 +281,7 @@ test_gnc_csv_new_parse_data (void)
 void gnc_csv_parse_data_free (GncCsvParseData* parse_data)// C: 3 in 1  Local: 0:0:0
 */
 // Basic freeing of memory - no test
+
 /* gnc_csv_convert_encoding
 int gnc_csv_convert_encoding (GncCsvParseData* parse_data, const char* encoding,// C: 1  Local: 1:0:0
 */
@@ -301,9 +316,8 @@ test_gnc_csv_load_file (Fixture *fixture, gconstpointer pData)
 int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)// C: 13 in 1  Local: 0:0:0
 */
 static void
-test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
+test_gnc_csv_parse_from_file (Fixture *fixture, gconstpointer pData)
 {
-
     GError *the_error = NULL;
     int resultcode = 0;
 
@@ -315,6 +329,62 @@ test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
     g_assert (g_strcmp0 ((char*)((GPtrArray*)(fixture->parse_data->orig_lines->pdata[1]))->pdata[6],
                          "1,100.00") == 0);
 }
+
+/* Test parsing for several different prepared strings
+ * These tests bypass file loading, rather taking a
+ * prepared set of strings as input. This makes it
+ * easier to add test cases without having to create new test files
+ * each time to load from.
+ * Note this bypasses encoding configuration, which should be tested
+ * independently.
+ */
+
+/* This helper function will run the parse step on the given data
+ * with the parser as configured by the calling test function.
+ * This allows the same code to be used with different csv test strings
+ * and parser option combinations.
+ */
+static void
+test_gnc_csv_parse_helper (GncCsvParseData *parse_data, gconstpointer pData)
+{
+    parse_test_data *test_data = (parse_test_data *) pData;
+    GError *the_error = NULL;
+    int resultcode = 0;
+    int i = 0;
+
+    while (test_data[i].csv_line)
+    {
+        int j;
+        parse_test_data cur_line = test_data[i];
+
+        g_test_message("Using string %s\n", cur_line.csv_line);
+        g_free (parse_data->file_str.begin);
+        parse_data->file_str.begin = g_strdup (cur_line.csv_line);
+        parse_data->file_str.end = parse_data->file_str.begin + strlen (parse_data->file_str.begin);
+        resultcode = gnc_csv_parse (parse_data, TRUE, &the_error);
+        g_assert (resultcode == 0);
+        for (j=0; j < cur_line.num_fields; j++)
+        {
+            g_assert (g_strcmp0 ((char*)((GPtrArray*)(parse_data->orig_lines->pdata[0]))->pdata[j],
+                     (cur_line.fields[j])) == 0);
+        }
+
+        i++;
+    }
+}
+
+static void
+test_gnc_csv_parse_comma_sep (Fixture *fixture, gconstpointer pData)
+{
+    GSList* sep_list = NULL;
+
+    sep_list = g_slist_append (sep_list, ",");
+    stf_parse_options_csv_set_separators (fixture->parse_data->options, NULL, sep_list);
+    g_slist_free (sep_list);
+
+    test_gnc_csv_parse_helper (fixture->parse_data, pData);
+}
+
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0
 */
@@ -359,7 +429,8 @@ GNC_TEST_ADD_FUNC (suitename, "gnc csv new parse data", test_gnc_csv_new_parse_d
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
 GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
-GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, samplefile1, setup_one_file, test_gnc_csv_parse, teardown);
+GNC_TEST_ADD (suitename, "gnc csv parse from file", Fixture, samplefile1, setup_one_file, test_gnc_csv_parse_from_file, teardown);
+GNC_TEST_ADD (suitename, "parse comma", Fixture, comma_separated, setup, test_gnc_csv_parse_comma_sep, teardown);
 // GNC_TEST_ADD (suitename, "trans property free", Fixture, NULL, setup, test_trans_property_free, teardown);
 // GNC_TEST_ADD (suitename, "trans property set", Fixture, NULL, setup, test_trans_property_set, teardown);
 // GNC_TEST_ADD (suitename, "trans property list free", Fixture, NULL, setup, test_trans_property_list_free, teardown);

commit 1a65e7165f55ce7fc091d95c2e7f892ad9f3d126
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Sep 28 20:41:26 2015 +0200

    csv-imp - use GNC_TEST_ADD_FUNC for test_parse_date as well

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index 5be262a..4ab6f5b 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -109,7 +109,7 @@ static time64 parse_date_without_year (const char* date_str, int format)// Local
 time64 parse_date (const char* date_str, int format)// C: 14 in 7 SCM: 9 in 2 Local: 1:0:0
 */
 static void
-test_parse_date (Fixture *fixture, gconstpointer pData)
+test_parse_date (void)
 {
     time64 rawtime = gnc_time_utc (NULL);
     struct tm *tm = gnc_gmtime (&rawtime);
@@ -354,7 +354,7 @@ test_suite_gnc_csv_model (void)
 
 // GNC_TEST_ADD (suitename, "parse date with year", Fixture, NULL, setup, test_parse_date_with_year, teardown);
 // GNC_TEST_ADD (suitename, "parse date without year", Fixture, NULL, setup, test_parse_date_without_year, teardown);
-GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, NULL, test_parse_date, NULL);
+GNC_TEST_ADD_FUNC (suitename, "parse date", test_parse_date);
 GNC_TEST_ADD_FUNC (suitename, "gnc csv new parse data", test_gnc_csv_new_parse_data);
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);

commit 1da2eacf2b121d6b618159335e3789511b3aaa7f
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Sep 28 20:22:34 2015 +0200

    csv-imp - test_gnc_csv_new_parse_data doesn't use the fixture
    
    So add the test via GNC_TEST_ADD_FUNC instead.
    This also fixes the segfault in gnc_csv_parse_data_free.

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index ca4325f..5be262a 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -255,13 +255,12 @@ test_parse_date (Fixture *fixture, gconstpointer pData)
 GncCsvParseData* gnc_csv_new_parse_data (void)// C: 1 in 1  Local: 0:0:0
 */
 static void
-test_gnc_csv_new_parse_data (Fixture *fixture, gconstpointer pData)
+test_gnc_csv_new_parse_data (void)
 {
     GncCsvParseData* parse_data = gnc_csv_new_parse_data ();
     g_assert (parse_data != NULL);
     g_assert (parse_data->chunk != NULL);
-    /* This makes the test-suite segfault, so I have disabled it for now */
-    // gnc_csv_parse_data_free (parse_data);
+    gnc_csv_parse_data_free (parse_data);
 }
 
 /* gnc_csv_parse_data_free
@@ -356,7 +355,7 @@ test_suite_gnc_csv_model (void)
 // GNC_TEST_ADD (suitename, "parse date with year", Fixture, NULL, setup, test_parse_date_with_year, teardown);
 // GNC_TEST_ADD (suitename, "parse date without year", Fixture, NULL, setup, test_parse_date_without_year, teardown);
 GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, NULL, test_parse_date, NULL);
-GNC_TEST_ADD (suitename, "gnc csv new parse data", Fixture, NULL, NULL, test_gnc_csv_new_parse_data, NULL);
+GNC_TEST_ADD_FUNC (suitename, "gnc csv new parse data", test_gnc_csv_new_parse_data);
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
 GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);

commit 88495d23b460e76de3b31e471b221a3b378627a9
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Sep 23 22:27:02 2015 +0200

    Match calls to g_string_chunk_new with g_string_chunk_free

diff --git a/src/import-export/csv-imp/gnc-csv-model.c b/src/import-export/csv-imp/gnc-csv-model.c
index 0a43e2a..416aff1 100644
--- a/src/import-export/csv-imp/gnc-csv-model.c
+++ b/src/import-export/csv-imp/gnc-csv-model.c
@@ -422,7 +422,7 @@ void gnc_csv_parse_data_free (GncCsvParseData* parse_data)
         g_list_free (parse_data->transactions);
     }
 
-    g_free (parse_data->chunk);
+    g_string_chunk_free (parse_data->chunk);
     g_free (parse_data);
 }
 

commit df55119654484af18d3292d159f9291a4b5d1a1f
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Sep 28 20:30:24 2015 +0200

    csv-imp - don't free the parse data just created for testing
    
    For some odd reason it makes the test segfault.

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index e65ba33..ca4325f 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -260,7 +260,8 @@ test_gnc_csv_new_parse_data (Fixture *fixture, gconstpointer pData)
     GncCsvParseData* parse_data = gnc_csv_new_parse_data ();
     g_assert (parse_data != NULL);
     g_assert (parse_data->chunk != NULL);
-    gnc_csv_parse_data_free (parse_data);
+    /* This makes the test-suite segfault, so I have disabled it for now */
+    // gnc_csv_parse_data_free (parse_data);
 }
 
 /* gnc_csv_parse_data_free

commit c59d1a223657e4e4c5f9861530e8a1b638d35fbe
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon Sep 28 20:27:56 2015 +0200

    csv-imp - move tests for gnc_csv_load_file to separate function

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index 0a639b4..e65ba33 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -42,20 +42,7 @@ typedef struct
     int          exp_day;
 } parse_date_data;
 
-static void
-setup( Fixture *fixture, gconstpointer pData )
-{
-    fixture->parse_data = gnc_csv_new_parse_data ();
-}
-
-static void
-teardown( Fixture *fixture, gconstpointer pData )
-{
-    gnc_csv_parse_data_free (fixture->parse_data);
-}
-
-static const gchar *suitename = "/import-export/csv-imp/gnc-csv-model";
-void test_suite_gnc_csv_model ( void );
+static const gchar* samplefile1 = "sample1.csv";
 
 static char* get_filepath(const char* filename, gboolean test_existence)
 {
@@ -79,6 +66,36 @@ static char* get_filepath(const char* filename, gboolean test_existence)
     return result;
 }
 
+static void
+setup( Fixture *fixture, gconstpointer pData )
+{
+    fixture->parse_data = gnc_csv_new_parse_data ();
+}
+
+static void
+setup_one_file( Fixture *fixture, gconstpointer pData )
+{
+    const gchar *filename = (const gchar*) pData;
+    char *filepath = get_filepath (filename, TRUE);
+    GError *the_error = NULL;
+    int resultcode = 0;
+
+    fixture->parse_data = gnc_csv_new_parse_data ();
+    resultcode = gnc_csv_load_file (fixture->parse_data, filepath,
+                                    &the_error);
+    g_assert (resultcode == 0);
+    g_free(filepath);
+}
+
+static void
+teardown( Fixture *fixture, gconstpointer pData )
+{
+    gnc_csv_parse_data_free (fixture->parse_data);
+}
+
+static const gchar *suitename = "/import-export/csv-imp/gnc-csv-model";
+void test_suite_gnc_csv_model ( void );
+
 /* parse_date_with_year
 time64 parse_date_with_year (const char* date_str, int format)// Local: 1:0:0
 */
@@ -260,15 +277,8 @@ test_gnc_csv_convert_encoding (Fixture *fixture, gconstpointer pData)
 /* gnc_csv_load_file
 int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,// C: 1  Local: 0:0:0
 */
-/* static void
-test_gnc_csv_load_file (Fixture *fixture, gconstpointer pData)
-{
-}*/
-/* gnc_csv_parse
-int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)// C: 13 in 1  Local: 0:0:0
-*/
 static void
-test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
+test_gnc_csv_load_file (Fixture *fixture, gconstpointer pData)
 {
 
     char *file1 = get_filepath ("notexist.csv", FALSE);
@@ -286,6 +296,16 @@ test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
     resultcode = gnc_csv_load_file (fixture->parse_data, file2,
                                     &the_error);
     g_assert (resultcode == 0);
+}
+/* gnc_csv_parse
+int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)// C: 13 in 1  Local: 0:0:0
+*/
+static void
+test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
+{
+
+    GError *the_error = NULL;
+    int resultcode = 0;
 
     /* Test basic parsing of the loaded file
      * A few fields are sampled in the parsed data. */
@@ -294,10 +314,6 @@ test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
                          "Date") == 0);
     g_assert (g_strcmp0 ((char*)((GPtrArray*)(fixture->parse_data->orig_lines->pdata[1]))->pdata[6],
                          "1,100.00") == 0);
-
-    /* Clean up */
-    g_free(file1);
-    g_free(file2);
 }
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0
@@ -342,8 +358,8 @@ GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, NULL, test_parse_date, NUL
 GNC_TEST_ADD (suitename, "gnc csv new parse data", Fixture, NULL, NULL, test_gnc_csv_new_parse_data, NULL);
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
-// GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
-GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, NULL, setup, test_gnc_csv_parse, teardown);
+GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
+GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, samplefile1, setup_one_file, test_gnc_csv_parse, teardown);
 // GNC_TEST_ADD (suitename, "trans property free", Fixture, NULL, setup, test_trans_property_free, teardown);
 // GNC_TEST_ADD (suitename, "trans property set", Fixture, NULL, setup, test_trans_property_set, teardown);
 // GNC_TEST_ADD (suitename, "trans property list free", Fixture, NULL, setup, test_trans_property_list_free, teardown);

commit 6b9823c61499b0bbb29b05766dcbc088175bf840
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Sep 23 18:27:28 2015 +0200

    csv-imp - test for gnc_csv_new_parse_data and skip gnc_csv_parse_data_free
    
    The latter has no output that can be tested on

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index f0f580b..0a639b4 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -234,13 +234,22 @@ test_parse_date (Fixture *fixture, gconstpointer pData)
 
 
 }
+/* gnc_csv_new_parse_data
+GncCsvParseData* gnc_csv_new_parse_data (void)// C: 1 in 1  Local: 0:0:0
+*/
+static void
+test_gnc_csv_new_parse_data (Fixture *fixture, gconstpointer pData)
+{
+    GncCsvParseData* parse_data = gnc_csv_new_parse_data ();
+    g_assert (parse_data != NULL);
+    g_assert (parse_data->chunk != NULL);
+    gnc_csv_parse_data_free (parse_data);
+}
+
 /* gnc_csv_parse_data_free
 void gnc_csv_parse_data_free (GncCsvParseData* parse_data)// C: 3 in 1  Local: 0:0:0
 */
-/* static void
-test_gnc_csv_parse_data_free (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Basic freeing of memory - no test
 /* gnc_csv_convert_encoding
 int gnc_csv_convert_encoding (GncCsvParseData* parse_data, const char* encoding,// C: 1  Local: 1:0:0
 */
@@ -330,6 +339,7 @@ test_suite_gnc_csv_model (void)
 // GNC_TEST_ADD (suitename, "parse date with year", Fixture, NULL, setup, test_parse_date_with_year, teardown);
 // GNC_TEST_ADD (suitename, "parse date without year", Fixture, NULL, setup, test_parse_date_without_year, teardown);
 GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, NULL, test_parse_date, NULL);
+GNC_TEST_ADD (suitename, "gnc csv new parse data", Fixture, NULL, NULL, test_gnc_csv_new_parse_data, NULL);
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);

commit 985bf549c3ff50902d3bb62e9e79f55ad138e748
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Sep 23 18:26:02 2015 +0200

    csv-imp - use setup and teardown for test_gnc_csv_parse

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index deaa595..f0f580b 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -30,6 +30,7 @@
 
 typedef struct
 {
+    GncCsvParseData* parse_data;
 } Fixture;
 
 typedef struct
@@ -44,12 +45,13 @@ typedef struct
 static void
 setup( Fixture *fixture, gconstpointer pData )
 {
-
+    fixture->parse_data = gnc_csv_new_parse_data ();
 }
 
 static void
 teardown( Fixture *fixture, gconstpointer pData )
 {
+    gnc_csv_parse_data_free (fixture->parse_data);
 }
 
 static const gchar *suitename = "/import-export/csv-imp/gnc-csv-model";
@@ -265,34 +267,28 @@ test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
     GError *the_error = NULL;
     int resultcode = 0;
 
-    GncCsvParseData* parse_data = gnc_csv_new_parse_data ();
-
-    /* Test if object creation worked */
-    g_assert (parse_data != NULL);
-
     /* Test loading of a non-existing file */
-    resultcode = gnc_csv_load_file (parse_data, file1,
+    resultcode = gnc_csv_load_file (fixture->parse_data, file1,
                                     &the_error);
     g_assert ((the_error->domain == GNC_CSV_IMP_ERROR) &&
               (the_error->code == GNC_CSV_IMP_ERROR_OPEN));
 
     /* Test loading of a valid csv file */
-    resultcode = gnc_csv_load_file (parse_data, file2,
-                                        &the_error);
+    resultcode = gnc_csv_load_file (fixture->parse_data, file2,
+                                    &the_error);
     g_assert (resultcode == 0);
 
     /* Test basic parsing of the loaded file
      * A few fields are sampled in the parsed data. */
-    resultcode = gnc_csv_parse (parse_data, TRUE, &the_error);
-    g_assert (g_strcmp0 ((char*)((GPtrArray*)(parse_data->orig_lines->pdata[0]))->pdata[0],
+    resultcode = gnc_csv_parse (fixture->parse_data, TRUE, &the_error);
+    g_assert (g_strcmp0 ((char*)((GPtrArray*)(fixture->parse_data->orig_lines->pdata[0]))->pdata[0],
                          "Date") == 0);
-    g_assert (g_strcmp0 ((char*)((GPtrArray*)(parse_data->orig_lines->pdata[1]))->pdata[6],
+    g_assert (g_strcmp0 ((char*)((GPtrArray*)(fixture->parse_data->orig_lines->pdata[1]))->pdata[6],
                          "1,100.00") == 0);
 
     /* Clean up */
     g_free(file1);
     g_free(file2);
-    gnc_csv_parse_data_free (parse_data);
 }
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0

commit ae40a4c6d8378a551bf84a36e9f03a939e40236f
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Sep 23 17:40:51 2015 +0200

    Mark static functions as not testable

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index 80deb45..deaa595 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -297,45 +297,27 @@ test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0
 */
-/* static void
-test_trans_property_free (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* trans_property_set
 static gboolean trans_property_set (TransProperty* prop, char* str)// Local: 1:0:0
 */
-/* static void
-test_trans_property_set (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* trans_property_list_free
 static void trans_property_list_free (TransPropertyList* list)// Local: 1:0:0
 */
-/* static void
-test_trans_property_list_free (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* trans_property_list_add
 static void trans_property_list_add (TransProperty* property)// Local: 1:0:0
 */
-/* static void
-test_trans_property_list_add (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* trans_add_split
 static void trans_add_split (Transaction* trans, Account* account, QofBook* book,// Local: 2:0:0
 */
-/* static void
-test_trans_add_split (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* trans_property_list_verify_essentials
 static gboolean trans_property_list_verify_essentials (TransPropertyList* list, gchar** error)// Local: 1:0:0
 */
-/* static void
-test_trans_property_list_verify_essentials (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper function - no test
 /* gnc_csv_parse_to_trans
 int gnc_csv_parse_to_trans (GncCsvParseData* parse_data, Account* account,// C: 2 in 1  Local: 0:0:0
 */

commit 2763b485f179a05f7674884fceed95af97c5b5b3
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Wed Jan 20 20:22:01 2016 +0100

    Test Date fixup

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index ea77b35..80deb45 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -189,7 +189,7 @@ test_parse_date (Fixture *fixture, gconstpointer pData)
         { 4,   "20130801",          -1,     -1, -1},
 
         // Sentinel to mark the end of available tests
-        {         NULL, 0,           0,     0,  0},
+        { 0,         NULL,           0,      0,  0},
 
     };
     int i = 0;

commit 8fba6e216d26243640dc6fa1d9da5c7515f46df5
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 22 19:27:19 2015 +0200

    csv-imp - add test for parse_date

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index ea8f20f..ea77b35 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -32,6 +32,15 @@ typedef struct
 {
 } Fixture;
 
+typedef struct
+{
+    int          date_fmt;
+    const gchar *date_str;
+    int          exp_year;
+    int          exp_month;
+    int          exp_day;
+} parse_date_data;
+
 static void
 setup( Fixture *fixture, gconstpointer pData )
 {
@@ -71,24 +80,158 @@ static char* get_filepath(const char* filename, gboolean test_existence)
 /* parse_date_with_year
 time64 parse_date_with_year (const char* date_str, int format)// Local: 1:0:0
 */
-/* static void
-test_parse_date_with_year (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper only - no tests.
 /* parse_date_without_year
 static time64 parse_date_without_year (const char* date_str, int format)// Local: 1:0:0
 */
-/* static void
-test_parse_date_without_year (Fixture *fixture, gconstpointer pData)
-{
-}*/
+// Internal helper only - no tests.
+
 /* parse_date
 time64 parse_date (const char* date_str, int format)// C: 14 in 7 SCM: 9 in 2 Local: 1:0:0
 */
-/* static void
+static void
 test_parse_date (Fixture *fixture, gconstpointer pData)
 {
-}*/
+    time64 rawtime = gnc_time_utc (NULL);
+    struct tm *tm = gnc_gmtime (&rawtime);
+    int curr_year = tm->tm_year;
+
+
+    /* Note: tm_year = year - 1900 and tm_mon = 0-11
+     * I'm writing the expected values as subtractions for easier
+     * comparison with the date string under test
+     */
+    parse_date_data test_dates[] =
+    {
+        // supported combinations  -/.'
+        { 0, "2013-08-01", 2013 - 1900,  8 - 1,  1},
+        { 0,  "2013-8-01", 2013 - 1900,  8 - 1,  1},
+        { 0,  "2013-08-1", 2013 - 1900,  8 - 1,  1},
+        { 0,   "2013-8-1", 2013 - 1900,  8 - 1,  1},
+        { 0,   "13-08-01", 2013 - 1900,  8 - 1,  1},
+        { 0,    "13-8-01", 2013 - 1900,  8 - 1,  1},
+        { 0,    "13-08-1", 2013 - 1900,  8 - 1,  1},
+        { 0,     "13-8-1", 2013 - 1900,  8 - 1,  1},
+        { 0, "2009/11/04", 2009 - 1900, 11 - 1,  4},
+        { 0,  "1985.3.12", 1985 - 1900,  3 - 1, 12},
+        { 0,      "3'6'8", 2003 - 1900,  6 - 1,  8},
+        { 0,   "20130801", 2013 - 1900,  8 - 1,  1},
+        { 1, "01-08-2013", 2013 - 1900,  8 - 1,  1},
+        { 1,  "01-8-2013", 2013 - 1900,  8 - 1,  1},
+        { 1,  "1-08-2013", 2013 - 1900,  8 - 1,  1},
+        { 1,   "1-8-2013", 2013 - 1900,  8 - 1,  1},
+        { 1,   "01-08-13", 2013 - 1900,  8 - 1,  1},
+        { 1,    "01-8-13", 2013 - 1900,  8 - 1,  1},
+        { 1,    "1-08-13", 2013 - 1900,  8 - 1,  1},
+        { 1,     "1-8-13", 2013 - 1900,  8 - 1,  1},
+        { 1, "04/11/2009", 2009 - 1900, 11 - 1,  4},
+        { 1,  "12.3.1985", 1985 - 1900,  3 - 1, 12},
+        { 1,      "8'6'3", 2003 - 1900,  6 - 1,  8},
+        { 1,   "01082013", 2013 - 1900,  8 - 1,  1},
+        { 2, "08-01-2013", 2013 - 1900,  8 - 1,  1},
+        { 2,  "8-01-2013", 2013 - 1900,  8 - 1,  1},
+        { 2,  "08-1-2013", 2013 - 1900,  8 - 1,  1},
+        { 2,   "8-1-2013", 2013 - 1900,  8 - 1,  1},
+        { 2,   "08-01-13", 2013 - 1900,  8 - 1,  1},
+        { 2,    "8-01-13", 2013 - 1900,  8 - 1,  1},
+        { 2,    "08-1-13", 2013 - 1900,  8 - 1,  1},
+        { 2,     "8-1-13", 2013 - 1900,  8 - 1,  1},
+        { 2, "11/04/2009", 2009 - 1900, 11 - 1,  4},
+        { 2,  "3.12.1985", 1985 - 1900,  3 - 1, 12},
+        { 2,      "6'8'3", 2003 - 1900,  6 - 1,  8},
+        { 2,   "08012013", 2013 - 1900,  8 - 1,  1},
+        { 3,      "01-08",   curr_year,  8 - 1,  1},
+        { 3,       "01-8",   curr_year,  8 - 1,  1},
+        { 3,       "1-08",   curr_year,  8 - 1,  1},
+        { 3,        "1-8",   curr_year,  8 - 1,  1},
+        { 3,      "04/11",   curr_year, 11 - 1,  4},
+        { 3,       "12.3",   curr_year,  3 - 1, 12},
+        { 3,        "8'6",   curr_year,  6 - 1,  8},
+        { 4,      "08-01",   curr_year,  8 - 1,  1},
+        { 4,       "8-01",   curr_year,  8 - 1,  1},
+        { 4,       "08-1",   curr_year,  8 - 1,  1},
+        { 4,        "8-1",   curr_year,  8 - 1,  1},
+        { 4,      "11/04",   curr_year, 11 - 1,  4},
+        { 4,       "3.12",   curr_year,  3 - 1, 12},
+        { 4,        "6'8",   curr_year,  6 - 1,  8},
+
+        // ambiguous date formats
+        // current parser doesn't know how to disambiguate
+        // and hence refuses to parse
+        // can possibly improved with a smarter parser
+        { 0,     "130801",          -1,     -1, -1},
+        { 1,     "010813",          -1,     -1, -1},
+        { 2,     "080113",          -1,     -1, -1},
+        { 3,       "0108",          -1,     -1, -1},
+        { 4,       "0801",          -1,     -1, -1},
+
+        // Combinations that don't make sense
+        // but can still be entered by a user
+        // Should ideally all result in refusal to parse...
+        { 0,      "08-01",          -1,     -1, -1},
+        { 0,       "0801",          -1,     -1, -1},
+        { 1,      "01-08",          -1,     -1, -1},
+        { 1,       "0108",          -1,     -1, -1},
+        { 2,      "08-01",          -1,     -1, -1},
+        { 2,       "0801",          -1,     -1, -1},
+        { 3, "01-08-2013",   curr_year,  8 - 1,  1}, // BAD behavior !
+        { 3,   "01-08-13",   curr_year,  8 - 1,  1}, // BAD behavior !
+        { 3,   "08-08-08",   curr_year,  8 - 1,  8}, // BAD behavior !
+        { 3,   "01082013",          -1,     -1, -1},
+        { 3,     "010813",          -1,     -1, -1},
+        { 3,   "20130108",          -1,     -1, -1},
+        { 4, "08-01-2013",   curr_year,  8 - 1,  1}, // BAD behavior !
+        { 4,   "08-01-13",   curr_year,  8 - 1,  1}, // BAD behavior !
+        { 4, "2013-08-01",          -1,     -1, -1},
+        { 4,   "09-08-01",   curr_year,  9 - 1,  8}, // BAD behavior !
+        { 4,   "08012013",          -1,     -1, -1},
+        { 4,     "080113",          -1,     -1, -1},
+        { 4,   "20130801",          -1,     -1, -1},
+
+        // Sentinel to mark the end of available tests
+        {         NULL, 0,           0,     0,  0},
+
+    };
+    int i = 0;
+
+    gnc_tm_free(tm);
+    while (test_dates[i].date_str)
+    {
+        gboolean success = TRUE;
+        int got_year = 0, got_month = 0, got_day = 0;
+
+        rawtime = parse_date (test_dates[i].date_str, test_dates[i].date_fmt);
+        if (rawtime == -1)
+            got_year = got_month = got_day = -1;
+        else
+        {
+            tm = gnc_gmtime (&rawtime);
+            got_year = tm->tm_year;
+            got_month = tm->tm_mon;
+            got_day = tm->tm_mday;
+            gnc_tm_free(tm);
+        }
+
+        if ((got_year  != test_dates[i].exp_year) ||
+            (got_month != test_dates[i].exp_month) ||
+            (got_day   != test_dates[i].exp_day))
+        {
+            g_error ("Parse_date failed for date '%s' and format '%d'.\n"
+                            "Expected result: year %d, month %d, day %d\n"
+                            "Obtained result: year %d, month %d, day %d",
+                            test_dates[i].date_str,
+                            test_dates[i].date_fmt,
+                            test_dates[i].exp_year,
+                            test_dates[i].exp_month,
+                            test_dates[i].exp_day,
+                            got_year, got_month, got_day);
+        }
+
+        i++;
+    }
+
+
+}
 /* gnc_csv_parse_data_free
 void gnc_csv_parse_data_free (GncCsvParseData* parse_data)// C: 3 in 1  Local: 0:0:0
 */
@@ -208,7 +351,7 @@ test_suite_gnc_csv_model (void)
 
 // GNC_TEST_ADD (suitename, "parse date with year", Fixture, NULL, setup, test_parse_date_with_year, teardown);
 // GNC_TEST_ADD (suitename, "parse date without year", Fixture, NULL, setup, test_parse_date_without_year, teardown);
-// GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, setup, test_parse_date, teardown);
+GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, NULL, test_parse_date, NULL);
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);

commit 598531f7e62200a76d23161e1aab1599fa484c8a
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 22 19:27:12 2015 +0200

    csv-imp - add basic test for gnc_csv_parse

diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
index 396a8dc..ea8f20f 100644
--- a/src/import-export/csv-imp/test/utest-gnc-csv-model.c
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -46,6 +46,28 @@ teardown( Fixture *fixture, gconstpointer pData )
 static const gchar *suitename = "/import-export/csv-imp/gnc-csv-model";
 void test_suite_gnc_csv_model ( void );
 
+static char* get_filepath(const char* filename, gboolean test_existence)
+{
+    char *result;
+
+    const char *srcdir = g_getenv("SRCDIR");
+    if (!srcdir)
+    {
+        g_test_message("No env variable SRCDIR exists, assuming \".\"\n");
+        srcdir = ".";
+    }
+
+    result = g_strdup_printf("%s/%s", srcdir, filename);
+
+    g_test_message("Using file path %s\n", result);
+
+    // Test whether the file really exists
+    if (test_existence)
+        g_assert(g_file_test(result, G_FILE_TEST_EXISTS));
+
+    return result;
+}
+
 /* parse_date_with_year
 time64 parse_date_with_year (const char* date_str, int format)// Local: 1:0:0
 */
@@ -91,10 +113,44 @@ test_gnc_csv_load_file (Fixture *fixture, gconstpointer pData)
 /* gnc_csv_parse
 int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)// C: 13 in 1  Local: 0:0:0
 */
-/* static void
+static void
 test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
 {
-}*/
+
+    char *file1 = get_filepath ("notexist.csv", FALSE);
+    char *file2 = get_filepath ("sample1.csv", TRUE);
+    GError *the_error = NULL;
+    int resultcode = 0;
+
+    GncCsvParseData* parse_data = gnc_csv_new_parse_data ();
+
+    /* Test if object creation worked */
+    g_assert (parse_data != NULL);
+
+    /* Test loading of a non-existing file */
+    resultcode = gnc_csv_load_file (parse_data, file1,
+                                    &the_error);
+    g_assert ((the_error->domain == GNC_CSV_IMP_ERROR) &&
+              (the_error->code == GNC_CSV_IMP_ERROR_OPEN));
+
+    /* Test loading of a valid csv file */
+    resultcode = gnc_csv_load_file (parse_data, file2,
+                                        &the_error);
+    g_assert (resultcode == 0);
+
+    /* Test basic parsing of the loaded file
+     * A few fields are sampled in the parsed data. */
+    resultcode = gnc_csv_parse (parse_data, TRUE, &the_error);
+    g_assert (g_strcmp0 ((char*)((GPtrArray*)(parse_data->orig_lines->pdata[0]))->pdata[0],
+                         "Date") == 0);
+    g_assert (g_strcmp0 ((char*)((GPtrArray*)(parse_data->orig_lines->pdata[1]))->pdata[6],
+                         "1,100.00") == 0);
+
+    /* Clean up */
+    g_free(file1);
+    g_free(file2);
+    gnc_csv_parse_data_free (parse_data);
+}
 /* trans_property_free
 static void trans_property_free (TransProperty* prop)// Local: 2:0:0
 */
@@ -156,7 +212,7 @@ test_suite_gnc_csv_model (void)
 // GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
 // GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
-// GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, NULL, setup, test_gnc_csv_parse, teardown);
+GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, NULL, setup, test_gnc_csv_parse, teardown);
 // GNC_TEST_ADD (suitename, "trans property free", Fixture, NULL, setup, test_trans_property_free, teardown);
 // GNC_TEST_ADD (suitename, "trans property set", Fixture, NULL, setup, test_trans_property_set, teardown);
 // GNC_TEST_ADD (suitename, "trans property list free", Fixture, NULL, setup, test_trans_property_list_free, teardown);

commit afff8102f44a2f0a6726f167811e07337061fe7a
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Mon May 11 21:30:51 2015 +0200

    csv-imp - add initial (empty) test framework

diff --git a/configure.ac b/configure.ac
index 8ad63c2..381e94d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1480,6 +1480,7 @@ AC_CONFIG_FILES(
   src/import-export/ofx/test/Makefile
   src/import-export/csv-imp/Makefile
   src/import-export/csv-imp/gschemas/Makefile
+  src/import-export/csv-imp/test/Makefile
   src/import-export/csv-exp/Makefile
   src/import-export/csv-exp/gschemas/Makefile
   src/import-export/log-replay/Makefile
diff --git a/src/import-export/csv-imp/Makefile.am b/src/import-export/csv-imp/Makefile.am
index 6d75ffb..0acf1b5 100644
--- a/src/import-export/csv-imp/Makefile.am
+++ b/src/import-export/csv-imp/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = . gschemas
+SUBDIRS = . gschemas test
 
 pkglib_LTLIBRARIES=libgncmod-csv-import.la
 
diff --git a/src/import-export/csv-imp/test/Makefile.am b/src/import-export/csv-imp/test/Makefile.am
new file mode 100644
index 0000000..e7ff7ba
--- /dev/null
+++ b/src/import-export/csv-imp/test/Makefile.am
@@ -0,0 +1,73 @@
+# A template Makefile.am for GLib g_test-based test directories.
+# Copyright 2011 John Ralls <jralls at ceridwen.us>
+
+include $(top_srcdir)/test-templates/Makefile.decl
+
+
+#You will only need one of these: It points to the module directory
+#after $(top_srcdir) or ${top_builddir}:
+MODULEPATH = src/import-export/csv-imp
+
+#The test program. You'll need to add to this if you have more than one module above.
+
+check_PROGRAMS = test-csv-imp
+
+TESTS = ${check_PROGRAMS}
+
+test_csv_impdir = ${top_srcdir}/${MODULEPATH}/test
+
+#Program files for tests go here. It's probably best to have one for
+#each file in the parent directory. Include
+#test_foo_support.c if you have one and aren't building the
+#support library.
+test_csv_imp_SOURCES = \
+  test-csv-imp.c \
+  utest-gnc-csv-model.c
+
+test_csv_imp_HEADERSS =
+
+#The tests might require more libraries, but try to keep them
+#as independent as possible.
+test_csv_imp_LDADD = \
+  ${top_builddir}/${MODULEPATH}/libgncmod-csv-import.la \
+  ${top_builddir}/src/import-export/libgncmod-generic-import.la \
+  ${top_builddir}/src/gnome/libgnc-gnome.la \
+  ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
+  ${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
+  ${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
+  ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
+  ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
+  ${top_builddir}/src/engine/libgncmod-engine.la \
+  ${top_builddir}/src/core-utils/libgnc-core-utils.la \
+  ${top_builddir}/src/gnc-module/libgnc-module.la \
+  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+  ${top_builddir}/lib/stf/libgnc-stf.la \
+  ${GLIB_LIBS}
+
+test_csv_imp_CFLAGS = \
+	-DTESTPROG=test_csv-imp \
+	${DEFAULT_INCLUDES} \
+	-I$(top_srcdir)/${MODULEPATH}/ \
+  -I${top_srcdir}/src/test-core \
+  -I${top_srcdir}/src \
+  -I${top_srcdir}/src/import-export \
+  -I${top_srcdir}/src/gnome \
+  -I${top_srcdir}/src/register/ledger-core \
+  -I${top_srcdir}/src/register/register-gnome \
+  -I${top_srcdir}/src/register/register-core \
+  -I${top_srcdir}/src/gnome-utils \
+  -I${top_srcdir}/src/app-utils \
+  -I${top_srcdir}/src/engine \
+  -I${top_srcdir}/src/core-utils \
+  -I${top_srcdir}/src/gnc-module \
+  -I${top_srcdir}/src/libqof/qof \
+  -I${top_srcdir}/lib/libc \
+  -I${top_srcdir}/lib \
+  ${GTK_CFLAGS} \
+  ${GLIB_CFLAGS}
+
+TESTS_ENVIRONMENT = \
+  SRCDIR=${srcdir} \
+  G_DEBUG=
+
+AM_CPPFLAGS = -DG_LOG_DOMAIN=\"gnc.import.csv\"
diff --git a/src/import-export/csv-imp/test/sample1.csv b/src/import-export/csv-imp/test/sample1.csv
new file mode 100644
index 0000000..503823a
--- /dev/null
+++ b/src/import-export/csv-imp/test/sample1.csv
@@ -0,0 +1,2 @@
+Date,Num,Description,Notes,Account,Deposit,Withdrawal,Balance
+05/01/15,45,Acme Inc.,,Miscellaneous,,"1,100.00",
diff --git a/src/import-export/csv-imp/test/test-csv-imp.c b/src/import-export/csv-imp/test/test-csv-imp.c
new file mode 100644
index 0000000..33cf83f
--- /dev/null
+++ b/src/import-export/csv-imp/test/test-csv-imp.c
@@ -0,0 +1,62 @@
+/********************************************************************
+ * testmain.c: GLib g_test test execution file.			    *
+ * Copyright 2011 John Ralls <jralls at ceridwen.us>		    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact:                        *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+\********************************************************************/
+
+#include <glib.h>
+#include "config.h"
+#include <qof.h>
+#include "backend/xml/gnc-backend-xml.h"
+#include "gnc-module/gnc-module.h"
+#include "engine/gnc-engine.h"
+#include <engine/TransLog.h>
+
+/* Declare the test suite assembly functions (see test-suite.c) for
+ * each sub-suite; avoids having header files. */
+
+extern GTestSuite *test_suite_gnc_csv_model();
+
+int
+main (int   argc,
+      char *argv[])
+{
+    qof_init(); 			/* Initialize the GObject system */
+    qof_log_init_filename_special("stderr"); /* Init the log system */
+    g_test_init ( &argc, &argv, NULL ); 	/* initialize test program */
+    qof_log_set_level("gnc", G_LOG_LEVEL_DEBUG);
+    g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */
+    /* Disable the transaction log */
+    xaccLogDisable();
+
+    gnc_module_system_init();
+    gnc_engine_init_static(argc, argv);
+    qof_load_backend_library ("../../../backend/xml/.libs/",
+                              "gncmod-backend-xml");
+
+    /* Add test functions and suites. See
+     * http://library.gnome.org/devel/glib/stable/glib-Testing.html for
+     * details. Unfortunately, GLib-Testing doesn't provide the automatic
+     * registration features of more sophisticated frameworks. */
+    test_suite_gnc_csv_model();
+
+    return g_test_run();
+}
+
+
diff --git a/src/import-export/csv-imp/test/utest-gnc-csv-model.c b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
new file mode 100644
index 0000000..396a8dc
--- /dev/null
+++ b/src/import-export/csv-imp/test/utest-gnc-csv-model.c
@@ -0,0 +1,168 @@
+/********************************************************************
+ * utest-gnc-csv-model.c: GLib g_test test suite for gnc-csv-model.c.		    *
+ * Copyright 2015 Geert Janssens <geert.gnucash at kobaltwit.be>		    *
+ *                                                                  *
+ * This program is free software; you can redistribute it and/or    *
+ * modify it under the terms of the GNU General Public License as   *
+ * published by the Free Software Foundation; either version 2 of   *
+ * the License, or (at your option) any later version.              *
+ *                                                                  *
+ * This program is distributed in the hope that it will be useful,  *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of   *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
+ * GNU General Public License for more details.                     *
+ *                                                                  *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, you can retrieve it from        *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html            *
+ * or contact:                                                      *
+ *                                                                  *
+ * Free Software Foundation           Voice:  +1-617-542-5942       *
+ * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652       *
+ * Boston, MA  02110-1301,  USA       gnu at gnu.org                   *
+ ********************************************************************/
+#include <config.h>
+#include <string.h>
+#include <glib.h>
+#include <unittest-support.h>
+/* Add specific headers for this class */
+#include "import-export/csv-imp/gnc-csv-model.h"
+
+typedef struct
+{
+} Fixture;
+
+static void
+setup( Fixture *fixture, gconstpointer pData )
+{
+
+}
+
+static void
+teardown( Fixture *fixture, gconstpointer pData )
+{
+}
+
+static const gchar *suitename = "/import-export/csv-imp/gnc-csv-model";
+void test_suite_gnc_csv_model ( void );
+
+/* parse_date_with_year
+time64 parse_date_with_year (const char* date_str, int format)// Local: 1:0:0
+*/
+/* static void
+test_parse_date_with_year (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* parse_date_without_year
+static time64 parse_date_without_year (const char* date_str, int format)// Local: 1:0:0
+*/
+/* static void
+test_parse_date_without_year (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* parse_date
+time64 parse_date (const char* date_str, int format)// C: 14 in 7 SCM: 9 in 2 Local: 1:0:0
+*/
+/* static void
+test_parse_date (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* gnc_csv_parse_data_free
+void gnc_csv_parse_data_free (GncCsvParseData* parse_data)// C: 3 in 1  Local: 0:0:0
+*/
+/* static void
+test_gnc_csv_parse_data_free (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* gnc_csv_convert_encoding
+int gnc_csv_convert_encoding (GncCsvParseData* parse_data, const char* encoding,// C: 1  Local: 1:0:0
+*/
+/* static void
+test_gnc_csv_convert_encoding (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* gnc_csv_load_file
+int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,// C: 1  Local: 0:0:0
+*/
+/* static void
+test_gnc_csv_load_file (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* gnc_csv_parse
+int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError** error)// C: 13 in 1  Local: 0:0:0
+*/
+/* static void
+test_gnc_csv_parse (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_property_free
+static void trans_property_free (TransProperty* prop)// Local: 2:0:0
+*/
+/* static void
+test_trans_property_free (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_property_set
+static gboolean trans_property_set (TransProperty* prop, char* str)// Local: 1:0:0
+*/
+/* static void
+test_trans_property_set (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_property_list_free
+static void trans_property_list_free (TransPropertyList* list)// Local: 1:0:0
+*/
+/* static void
+test_trans_property_list_free (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_property_list_add
+static void trans_property_list_add (TransProperty* property)// Local: 1:0:0
+*/
+/* static void
+test_trans_property_list_add (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_add_split
+static void trans_add_split (Transaction* trans, Account* account, QofBook* book,// Local: 2:0:0
+*/
+/* static void
+test_trans_add_split (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* trans_property_list_verify_essentials
+static gboolean trans_property_list_verify_essentials (TransPropertyList* list, gchar** error)// Local: 1:0:0
+*/
+/* static void
+test_trans_property_list_verify_essentials (Fixture *fixture, gconstpointer pData)
+{
+}*/
+/* gnc_csv_parse_to_trans
+int gnc_csv_parse_to_trans (GncCsvParseData* parse_data, Account* account,// C: 2 in 1  Local: 0:0:0
+*/
+/* static void
+test_gnc_csv_parse_to_trans (Fixture *fixture, gconstpointer pData)
+{
+}*/
+
+
+void
+test_suite_gnc_csv_model (void)
+{
+
+// GNC_TEST_ADD (suitename, "parse date with year", Fixture, NULL, setup, test_parse_date_with_year, teardown);
+// GNC_TEST_ADD (suitename, "parse date without year", Fixture, NULL, setup, test_parse_date_without_year, teardown);
+// GNC_TEST_ADD (suitename, "parse date", Fixture, NULL, setup, test_parse_date, teardown);
+// GNC_TEST_ADD (suitename, "gnc csv parse data free", Fixture, NULL, setup, test_gnc_csv_parse_data_free, teardown);
+// GNC_TEST_ADD (suitename, "gnc csv convert encoding", Fixture, NULL, setup, test_gnc_csv_convert_encoding, teardown);
+// GNC_TEST_ADD (suitename, "gnc csv load file", Fixture, NULL, setup, test_gnc_csv_load_file, teardown);
+// GNC_TEST_ADD (suitename, "gnc csv parse", Fixture, NULL, setup, test_gnc_csv_parse, teardown);
+// GNC_TEST_ADD (suitename, "trans property free", Fixture, NULL, setup, test_trans_property_free, teardown);
+// GNC_TEST_ADD (suitename, "trans property set", Fixture, NULL, setup, test_trans_property_set, teardown);
+// GNC_TEST_ADD (suitename, "trans property list free", Fixture, NULL, setup, test_trans_property_list_free, teardown);
+// GNC_TEST_ADD (suitename, "trans property list add", Fixture, NULL, setup, test_trans_property_list_add, teardown);
+// GNC_TEST_ADD (suitename, "trans add split", Fixture, NULL, setup, test_trans_add_split, teardown);
+// GNC_TEST_ADD (suitename, "trans property list verify essentials", Fixture, NULL, setup, test_trans_property_list_verify_essentials, teardown);
+// GNC_TEST_ADD (suitename, "gnc csv parse to trans", Fixture, NULL, setup, test_gnc_csv_parse_to_trans, teardown);
+
+}

commit 8168f45a6fcad86c3b2aed91c709411df72bba4d
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 22 18:49:06 2015 +0200

    Set fixed time values so test results won't depend on the time the test is run

diff --git a/src/import-export/csv-imp/gnc-csv-model.c b/src/import-export/csv-imp/gnc-csv-model.c
index 9fa51ef..0a43e2a 100644
--- a/src/import-export/csv-imp/gnc-csv-model.c
+++ b/src/import-export/csv-imp/gnc-csv-model.c
@@ -155,10 +155,14 @@ static time64 parse_date_with_year (const char* date_str, int format)
         }
     }
 
-    /* Put some sane values in retvalue by using the current time for
+    /* Put some sane values in retvalue by using a fixed time for
      * the non-year-month-day parts of the date. */
     gnc_time (&rawtime);
     gnc_localtime_r (&rawtime, &retvalue);
+    retvalue.tm_hour = 11;
+    retvalue.tm_min = 0;
+    retvalue.tm_sec = 0;
+    retvalue.tm_isdst = -1;
 
     /* j traverses pmatch (index 0 contains the entire string, so we
      * start at index 1 for the first meaningful match). */
@@ -265,10 +269,14 @@ static time64 parse_date_without_year (const char* date_str, int format)
     if (pmatch[0].rm_eo == 0)
         return -1;
 
-    /* Put some sane values in retvalue by using the current time for
+    /* Put some sane values in retvalue by using a fixed time for
      * the non-year-month-day parts of the date. */
     gnc_time (&rawtime);
     gnc_localtime_r (&rawtime, &retvalue);
+    retvalue.tm_hour = 11;
+    retvalue.tm_min = 0;
+    retvalue.tm_sec = 0;
+    retvalue.tm_isdst = -1;
     orig_year = retvalue.tm_year;
 
     /* j traverses pmatch (index 0 contains the entire string, so we

commit 25542415a6a5b97c5dfacb3de955ef2ab59178b0
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue May 12 21:58:24 2015 +0200

    Adjust GError usage to comply with the GError rules
    
    - Define an error domain (different from 0)
    - Adjust member names in error enumeration to follow
      required naming conventions

diff --git a/src/import-export/csv-imp/assistant-csv-trans-import.c b/src/import-export/csv-imp/assistant-csv-trans-import.c
index 96fac06..d7e99d3 100644
--- a/src/import-export/csv-imp/assistant-csv-trans-import.c
+++ b/src/import-export/csv-imp/assistant-csv-trans-import.c
@@ -187,7 +187,7 @@ csv_import_trans_file_chooser_confirm_cb (GtkWidget *button, CsvImportTrans *inf
         {
             /* If we couldn't load the file ... */
             gnc_error_dialog (NULL, "%s", error->message);
-            if (error->code == GNC_CSV_FILE_OPEN_ERR)
+            if (error->code == GNC_CSV_IMP_ERROR_OPEN)
             {
                 gnc_csv_parse_data_free (parse_data);
                 return;
diff --git a/src/import-export/csv-imp/gnc-csv-model.c b/src/import-export/csv-imp/gnc-csv-model.c
index 4e40df4..9fa51ef 100644
--- a/src/import-export/csv-imp/gnc-csv-model.c
+++ b/src/import-export/csv-imp/gnc-csv-model.c
@@ -44,6 +44,12 @@
 #include <stdlib.h>
 #include <math.h>
 
+GQuark
+gnc_csv_imp_error_quark (void)
+{
+  return g_quark_from_static_string ("g-csv-imp-error-quark");
+}
+
 G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_IMPORT;
 
 const int num_date_formats = 5;
@@ -466,14 +472,13 @@ int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,
     const char* guess_enc = NULL;
 
     /* Get the raw data first and handle an error if one occurs. */
-    parse_data->raw_mapping = g_mapped_file_new (filename, FALSE, error);
+    parse_data->raw_mapping = g_mapped_file_new (filename, FALSE, NULL);
     if (parse_data->raw_mapping == NULL)
     {
         /* TODO Handle file opening errors more specifically,
          * e.g. inexistent file versus no read permission. */
         parse_data->raw_str.begin = NULL;
-        g_clear_error (error);
-        g_set_error (error, 0, GNC_CSV_FILE_OPEN_ERR, "%s", _("File opening failed."));
+        g_set_error (error, GNC_CSV_IMP_ERROR, GNC_CSV_IMP_ERROR_OPEN, "%s", _("File opening failed."));
         return 1;
     }
 
@@ -488,7 +493,7 @@ int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,
                                       "UTF-8", NULL);
     if (guess_enc == NULL)
     {
-        g_set_error (error, 0, GNC_CSV_ENCODING_ERR, "%s", _("Unknown encoding."));
+        g_set_error (error, GNC_CSV_IMP_ERROR, GNC_CSV_IMP_ERROR_ENCODING, "%s", _("Unknown encoding."));
         return 1;
     }
     /* Convert using the guessed encoding into parse_data->file_str and
@@ -496,7 +501,7 @@ int gnc_csv_load_file (GncCsvParseData* parse_data, const char* filename,
     gnc_csv_convert_encoding (parse_data, guess_enc, error);
     if (parse_data->file_str.begin == NULL)
     {
-        g_set_error (error, 0, GNC_CSV_ENCODING_ERR, "%s", _("Unknown encoding."));
+        g_set_error (error, GNC_CSV_IMP_ERROR, GNC_CSV_IMP_ERROR_ENCODING, "%s", _("Unknown encoding."));
         return 1;
     }
     else
@@ -559,7 +564,7 @@ int gnc_csv_parse (GncCsvParseData* parse_data, gboolean guessColTypes, GError**
     /* If it failed, generate an error. */
     if (parse_data->orig_lines == NULL)
     {
-        g_set_error (error, 0, 0, "Parsing failed.");
+        g_set_error (error, GNC_CSV_IMP_ERROR, GNC_CSV_IMP_ERROR_PARSE, "Parsing failed.");
         return 1;
     }
 
diff --git a/src/import-export/csv-imp/gnc-csv-model.h b/src/import-export/csv-imp/gnc-csv-model.h
index 161dca4..b476913 100644
--- a/src/import-export/csv-imp/gnc-csv-model.h
+++ b/src/import-export/csv-imp/gnc-csv-model.h
@@ -51,12 +51,18 @@ enum GncCsvColumnType {
     GNC_CSV_NUM_COL_TYPES
 };
 
+/** Error domain for the csv importer. */
+#define GNC_CSV_IMP_ERROR gnc_csv_imp_error_quark ()
+GQuark gnc_csv_imp_error_quark (void);
+
 /** Enumeration for error types. These are the different types of
  * errors that various functions used for the CSV/Fixed-Width importer
  * can have. */
-enum GncCsvErrorType {GNC_CSV_FILE_OPEN_ERR,
-                      GNC_CSV_ENCODING_ERR
-                     };
+enum GncCsvErrorType {
+    GNC_CSV_IMP_ERROR_OPEN,
+    GNC_CSV_IMP_ERROR_ENCODING,
+    GNC_CSV_IMP_ERROR_PARSE
+};
 
 /** Struct for containing a string. This struct simply contains
  * pointers to the beginning and end of a string. We need this because

commit bd59bab28f8215ae4c8d49cf56351aee95d5e6cb
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue Sep 22 18:58:39 2015 +0200

    Cumulated minor spelling fixes in comments
    and other non-code texts

diff --git a/src/engine/test/utest-Account.c b/src/engine/test/utest-Account.c
index 0f23dfc..f0f2aba 100644
--- a/src/engine/test/utest-Account.c
+++ b/src/engine/test/utest-Account.c
@@ -825,7 +825,7 @@ xaccAccountCommitEdit checks the flag and finding it true:
    Again checking that the book isn't shutting down:
       run destroy_pending_splits_for_account
       destroy all of the lots in the lots list (again, destroy, not unref or even dispose)
-  free the lot list (regardless of whether the book is shuttin down) and NULL the pointer
+  free the lot list (regardless of whether the book is shutting down) and NULL the pointer
   set the instance dirty
 unconditionally calls qof_commit_edit_part2 with acc_free
 qof_commit_edit_part2:
diff --git a/src/import-export/csv-imp/gnc-csv-model.c b/src/import-export/csv-imp/gnc-csv-model.c
index b761200..4e40df4 100644
--- a/src/import-export/csv-imp/gnc-csv-model.c
+++ b/src/import-export/csv-imp/gnc-csv-model.c
@@ -172,7 +172,7 @@ static time64 parse_date_with_year (const char* date_str, int format)
             date_segment[mem_length] = '\0';
 
             /* Set the appropriate member of retvalue. Save the original
-             * values so that we can check if the change when we use gnc_mktime
+             * values so that we can check if they change when we use gnc_mktime
              * below. */
             switch (segment_type)
             {
@@ -284,7 +284,7 @@ static time64 parse_date_without_year (const char* date_str, int format)
             date_segment[mem_length] = '\0';
 
             /* Set the appropriate member of retvalue. Save the original
-             * values so that we can check if the change when we use gnc_mktime
+             * values so that we can check if they change when we use gnc_mktime
              * below. */
             switch (segment_type)
             {
diff --git a/src/libqof/qof/gnc-date.h b/src/libqof/qof/gnc-date.h
index a66f4a4..56fed84 100644
--- a/src/libqof/qof/gnc-date.h
+++ b/src/libqof/qof/gnc-date.h
@@ -38,7 +38,7 @@
     stores and use UNIVERSAL TIME internally.  Universal time is the
     'one true time' that is independent of one's location on planet
     Earth.  It is measured in seconds from midnight January 1, 1970
-    in localtime-Grenwich (GMT).  If one wants to display the local
+    in localtime-Greenwich (GMT).  If one wants to display the local
     time, then the display-print routine should make all final
     tweaks to print the local time.   The local time *must not* be
     kept as a numeric value anywhere in the program.   If one wants
@@ -104,10 +104,10 @@ extern const char *gnc_default_strftime_date_format;
 /** Constants *******************************************************/
 /** \brief UTC date format string.
 
-Timezone independent, date and time inclusive, as used in the QSF backend.
+Time zone independent, date and time inclusive, as used in the QSF backend.
 The T and Z characters are from xsd:dateTime format in coordinated universal time, UTC.
 You can reproduce the string from the GNU/Linux command line using the date utility:
-date -u +%Y-%m-%dT%H:M:SZ = 2004-12-12T23:39:11Z The datestring must be timezone independent
+date -u +%Y-%m-%dT%H:M:SZ = 2004-12-12T23:39:11Z The datestring must be time zone independent
 and include all specified fields. Remember to use gmtime() NOT localtime()!
 */
 
@@ -216,7 +216,7 @@ gchar* gnc_ctime (const time64 *secs);
  */
 time64 gnc_time (time64 *tbuf);
 
-/** \brief get the current utc time
+/** \brief get the current UTC time
  *  \param A time64* which, if not NULL, will be filled in with the same
  * value as is returned.
  * \return Seconds since 00:00:01 UTC 01 January 1970 (negative values
@@ -235,7 +235,7 @@ time64 gnc_time_utc (time64 *tbuf);
 gdouble gnc_difftime (const time64 secs1, const time64 secs2);
 
 /** Wrapper for g_date_time_new_from_unix_local() that takes special care on
- * windows to take the local timezone into account. On unix, it just calles the
+ * windows to take the local time zone into account. On unix, it just calls the
  * g_date function. */
 GDateTime*
 gnc_g_date_time_new_from_unix_local (time64 time);
@@ -311,12 +311,12 @@ gboolean timespec_equal(const Timespec *ta, const Timespec *tb);
 /** comparison:  if (ta < tb) -1; else if (ta > tb) 1; else 0; */
 gint      timespec_cmp(const Timespec *ta, const Timespec *tb);
 
-/** difference between ta and tb, results are normalised
+/** difference between ta and tb, results are normalized
  * ie tv_sec and tv_nsec of the result have the same size
  * abs(result.tv_nsec) <= 1000000000 */
 Timespec timespec_diff(const Timespec *ta, const Timespec *tb);
 
-/** absolute value, also normalised */
+/** absolute value, also normalized */
 Timespec timespec_abs(const Timespec *t);
 
 /** convert a timepair on a certain day (localtime) to
@@ -354,15 +354,15 @@ Timespec gnc_dmy2timespec_end (gint day, gint month, gint year);
 /** The gnc_iso8601_to_timespec_gmt() routine converts an ISO-8601 style
  *    date/time string to Timespec.  Please note that ISO-8601 strings
  *    are a representation of Universal Time (UTC), and as such, they
- *    'store' UTC.  To make them human readable, they show timezone
+ *    'store' UTC.  To make them human readable, they show time zone
  *    information along with a local-time string.  But fundamentally,
- *    they *are* UTC.  Thus, thir routine takes a UTC input, and
+ *    they *are* UTC.  Thus, this routine takes a UTC input, and
  *    returns a UTC output.
  *
  *    For example: 1998-07-17 11:00:00.68-0500
  *    is 680 milliseconds after 11 o'clock, central daylight time
- *    It is also 680 millisecs after 16:00:00 hours UTC.
- *    \return The universl time.
+ *    It is also 680 milliseconds after 16:00:00 hours UTC.
+ *    \return The universal time.
  *
  * XXX Caution: this routine does not handle strings that specify
  * times before January 1 1970.
@@ -378,12 +378,12 @@ Timespec gnc_iso8601_to_timespec_gmt(const gchar *);
  *
  *    Please note that ISO-8601 strings are a representation of
  *    Universal Time (UTC), and as such, they 'store' UTC.  To make them
- *    human readable, they show timezone information along with a
+ *    human readable, they show time zone information along with a
  *    local-time string.  But fundamentally, they *are* UTC.  Thus,
  *    this routine takes a UTC input, and returns a UTC output.
  *
- *    The string generated by this routine uses the local timezone
- *    on the machine on which it is executing to create the timestring.
+ *    The string generated by this routine uses the local time zone
+ *    on the machine on which it is executing to create the time string.
  */
 gchar * gnc_timespec_to_iso8601_buff (Timespec ts, gchar * buff);
 
@@ -403,8 +403,8 @@ void gnc_timespec2dmy (Timespec ts, gint *day, gint *month, gint *year);
  * by mktime. This is a strange function! It requires that localtime
  * or mktime be called before use. Subsequent calls to localtime or
  * mktime *may* invalidate the result! The actual contents of tm *may*
- * be used for both timezone offset and daylight savings time, or only
- * daylight savings time! Timezone stuff under unix is not
+ * be used for both time zone offset and daylight savings time, or only
+ * daylight savings time! time zone stuff under unix is not
  * standardized and is a big mess.
  */
 glong gnc_timezone (const struct tm *tm);
@@ -414,7 +414,7 @@ glong gnc_timezone (const struct tm *tm);
 /** \name QofDateFormat functions */
 // @{
 /** The qof_date_format_get routine returns the date format that
- *  the date printing will use when printing a date, and the scaning
+ *  the date printing will use when printing a date, and the scanning
  *  routines will assume when parsing a date.
  * @returns: the one of the enumerated date formats.
  */
diff --git a/test-templates/make-testfile b/test-templates/make-testfile
index fe28b33..3c4aa15 100755
--- a/test-templates/make-testfile
+++ b/test-templates/make-testfile
@@ -278,7 +278,7 @@ make_testfile "Author Name <author at email.addr>" path/to/input [path/to/output]
 Creates template unit test files from C source files. The default
 output file is utest-filename in a subdirectory named "test". For
 example, if the input file is src/engine/Account.c, the default output
-file will be src/engine/test/test-Account.c.
+file will be src/engine/test/utest-Account.c.
 
 The program scans the input file to find function signatures. Each
 function signature will generate a comment with the function's

commit 24773aa2937e24ff8da0ab1ae3a92170c530d872
Author: Geert Janssens <janssens-geert at telenet.be>
Date:   Tue May 12 21:56:55 2015 +0200

    Some indentation adapations

diff --git a/src/import-export/csv-imp/gnc-csv-model.h b/src/import-export/csv-imp/gnc-csv-model.h
index 4b00782..161dca4 100644
--- a/src/import-export/csv-imp/gnc-csv-model.h
+++ b/src/import-export/csv-imp/gnc-csv-model.h
@@ -38,17 +38,18 @@
  * columns that can exist in a CSV/Fixed-Width file. There should be
  * no two columns with the same type except for the GNC_CSV_NONE
  * type. */
-enum GncCsvColumnType {GNC_CSV_NONE,
-                       GNC_CSV_DATE,
-                       GNC_CSV_NUM,
-                       GNC_CSV_DESCRIPTION,
-                       GNC_CSV_NOTES,
-                       GNC_CSV_ACCOUNT,
-                       GNC_CSV_DEPOSIT,
-                       GNC_CSV_WITHDRAWAL,
-                       GNC_CSV_BALANCE,
-                       GNC_CSV_NUM_COL_TYPES
-                      };
+enum GncCsvColumnType {
+    GNC_CSV_NONE,
+    GNC_CSV_DATE,
+    GNC_CSV_NUM,
+    GNC_CSV_DESCRIPTION,
+    GNC_CSV_NOTES,
+    GNC_CSV_ACCOUNT,
+    GNC_CSV_DEPOSIT,
+    GNC_CSV_WITHDRAWAL,
+    GNC_CSV_BALANCE,
+    GNC_CSV_NUM_COL_TYPES
+};
 
 /** Enumeration for error types. These are the different types of
  * errors that various functions used for the CSV/Fixed-Width importer



Summary of changes:
 configure.ac                                       |   1 +
 src/engine/test/utest-Account.c                    |   2 +-
 src/import-export/csv-imp/Makefile.am              |   2 +-
 .../csv-imp/assistant-csv-trans-import.c           |   2 +-
 src/import-export/csv-imp/gnc-csv-model.c          |  35 +-
 src/import-export/csv-imp/gnc-csv-model.h          |  35 +-
 src/import-export/csv-imp/test/Makefile.am         |  73 ++++
 src/import-export/csv-imp/test/sample1.csv         |   2 +
 .../csv-imp/test/test-csv-imp.c}                   |  40 +-
 .../csv-imp/test/utest-gnc-csv-model.c             | 462 +++++++++++++++++++++
 src/libqof/qof/gnc-date.h                          |  34 +-
 test-templates/make-testfile                       |   2 +-
 12 files changed, 627 insertions(+), 63 deletions(-)
 create mode 100644 src/import-export/csv-imp/test/Makefile.am
 create mode 100644 src/import-export/csv-imp/test/sample1.csv
 copy src/{engine/test/test-engine.c => import-export/csv-imp/test/test-csv-imp.c} (68%)
 create mode 100644 src/import-export/csv-imp/test/utest-gnc-csv-model.c



More information about the gnucash-changes mailing list