gnucash unstable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Jan 16 20:27:12 EST 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/26fa2acf (commit)
	 via  https://github.com/Gnucash/gnucash/commit/8f96882e (commit)
	from  https://github.com/Gnucash/gnucash/commit/3c1dc14d (commit)



commit 26fa2acfd5f32d03f6a9d1a224fe1503c9a5b25b
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 16 17:24:20 2018 -0800

    Use a more appropriate comparison for doubles.

diff --git a/libgnucash/engine/test/gtest-gnc-numeric.cpp b/libgnucash/engine/test/gtest-gnc-numeric.cpp
index 5237445..82d6b8f 100644
--- a/libgnucash/engine/test/gtest-gnc-numeric.cpp
+++ b/libgnucash/engine/test/gtest-gnc-numeric.cpp
@@ -293,7 +293,7 @@ TEST(gncnumeric_operators, double_conversion)
 {
     GncNumeric a(123456789, 9876);
     double b = static_cast<decltype(b)>(a);
-    EXPECT_EQ(12500.687424058324, b);
+    EXPECT_DOUBLE_EQ(12500.687424058324, b);
 }
 
 TEST(gncnumeric_operators, test_addition)

commit 8f96882eadc86c788d28cf81ef4fe40cf737eb17
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Jan 16 17:20:31 2018 -0800

    Remove tests checking members of deleted objects.
    
    GLib's scribbling of freed memory is enabled on Arch so attempting to
    read the deleted members of inst and book crash instead of reaturning
    invalid results. These weren't really useful tests anyway.

diff --git a/libgnucash/engine/test/test-qofinstance.cpp b/libgnucash/engine/test/test-qofinstance.cpp
index 7ed7d2d..292e250 100644
--- a/libgnucash/engine/test/test-qofinstance.cpp
+++ b/libgnucash/engine/test/test-qofinstance.cpp
@@ -230,35 +230,7 @@ test_instance_new_destroy( void )
 
     g_test_message( "Testing object destruction" );
     g_object_unref( inst );
-    /* test fields were deinitialized */
-    g_assert( inst );
-    g_assert( !QOF_IS_INSTANCE( inst ) );
-    /* set fatal handler */
-    g_test_log_set_fatal_handler ( ( GTestLogFatalFunc )fatal_handler, NULL );
-    auto hdlr = g_log_set_handler (log_domain, loglevel,
-                                   (GLogFunc)test_checked_handler, check);
-    g_assert( qof_instance_get_collection( inst ) == NULL );
-    g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
-    g_free( error_message );
-
-    g_free(check->msg);
-    check->msg = g_strdup(msg2);
-    g_assert_cmpint( qof_instance_get_editlevel( inst ), == , 0 );
-    g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
-    g_free( error_message );
-
-    g_free(check->msg);
-    check->msg = g_strdup(msg3);
-    g_assert( !qof_instance_get_destroying( inst ) );
-    g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
     g_free( error_message );
-
-    g_free(check->msg);
-    check->msg = g_strdup(msg4);
-    g_assert( !qof_instance_get_dirty_flag( inst ) );
-    g_assert( g_strrstr( error_message, "assertion 'QOF_IS_INSTANCE(ptr)' failed" ) != NULL );
-    g_free( error_message );
-    g_log_remove_handler (log_domain, hdlr);
     test_error_struct_free(check);
 }
 
diff --git a/libgnucash/engine/test/utest-Transaction.cpp b/libgnucash/engine/test/utest-Transaction.cpp
index c322c66..e053517 100644
--- a/libgnucash/engine/test/utest-Transaction.cpp
+++ b/libgnucash/engine/test/utest-Transaction.cpp
@@ -1358,19 +1358,13 @@ test_xaccTransBeginEdit ()
     xaccTransRollbackEdit (txn);
     g_assert_cmpint (0, ==, qof_instance_get_editlevel (QOF_INSTANCE (txn)));
     g_assert (txn->orig == NULL);
-    qof_book_destroy (book);
-    xaccTransBeginEdit (txn);
-    g_assert_cmpint (1, ==, qof_instance_get_editlevel (QOF_INSTANCE (txn)));
-    g_assert (txn->orig == NULL);
-    g_assert_cmpint (1, ==, check1->hits);
-    g_assert_cmpint (2, ==, check2->hits);
 
     g_log_remove_handler (logdomain, hdlr);
     test_clear_error_list ();
     test_error_struct_free (check1);
     test_error_struct_free (check2);
-    /* qof_book_destroy has already removed enough of the innards that
-       trying to unref the txn and book crashes. */
+    xaccTransDestroy (txn);
+    qof_book_destroy (book);
 }
 /* xaccTransDestroy
 void



Summary of changes:
 libgnucash/engine/test/gtest-gnc-numeric.cpp |  2 +-
 libgnucash/engine/test/test-qofinstance.cpp  | 28 ----------------------------
 libgnucash/engine/test/utest-Transaction.cpp | 10 ++--------
 3 files changed, 3 insertions(+), 37 deletions(-)



More information about the gnucash-changes mailing list