gnucash maint: [utest-Account] test old dxaccAccount* functions

Christopher Lam clam at code.gnucash.org
Sun Sep 19 04:54:22 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/43094697 (commit)
	from  https://github.com/Gnucash/gnucash/commit/57cb8c19 (commit)



commit 43094697306ec68c1133dfb11ef357bae8f473ca
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Sep 19 10:34:19 2021 +0800

    [utest-Account] test old dxaccAccount* functions
    
    dxaccAccountGetPriceSrc and dxaccAccountGetQuoteTZ.
    
    DxaccAccountSetCurrency remains untested - unsure how to retrieve an
    ISO4217 currency to use as parameter.

diff --git a/libgnucash/engine/test/utest-Account.cpp b/libgnucash/engine/test/utest-Account.cpp
index 2759c38f0..e7072e394 100644
--- a/libgnucash/engine/test/utest-Account.cpp
+++ b/libgnucash/engine/test/utest-Account.cpp
@@ -1216,6 +1216,33 @@ test_gnc_account_kvp_setters_getters (Fixture *fixture, gconstpointer pData)
     xaccAccountSetNotes (account, nullptr);
     g_assert_cmpstr (xaccAccountGetNotes (account), ==, nullptr);
 
+    // STOCK_ACCOUNT tests from now on
+    xaccAccountSetType (account, ACCT_TYPE_STOCK);
+
+    // dxaccAccountGetPriceSrc getter/setter
+    g_assert_cmpstr (dxaccAccountGetPriceSrc (account), ==, nullptr);
+
+    dxaccAccountSetPriceSrc (account, "boo");
+    g_assert_cmpstr (dxaccAccountGetPriceSrc (account), ==, "boo");
+
+    dxaccAccountSetPriceSrc (account, "");
+    g_assert_cmpstr (dxaccAccountGetPriceSrc (account), ==, "");
+
+    dxaccAccountSetPriceSrc (account, nullptr);
+    g_assert_cmpstr (dxaccAccountGetPriceSrc (account), ==, nullptr);
+
+    // dxaccAccountGetQuoteTZ getter/setter
+    g_assert_cmpstr (dxaccAccountGetQuoteTZ (account), ==, nullptr);
+
+    dxaccAccountSetQuoteTZ (account, "boo");
+    g_assert_cmpstr (dxaccAccountGetQuoteTZ (account), ==, "boo");
+
+    dxaccAccountSetQuoteTZ (account, "");
+    g_assert_cmpstr (dxaccAccountGetQuoteTZ (account), ==, "");
+
+    dxaccAccountSetQuoteTZ (account, nullptr);
+    g_assert_cmpstr (dxaccAccountGetQuoteTZ (account), ==, nullptr);
+
     xaccAccountBeginEdit (account);
     xaccAccountDestroy (account);
 }



Summary of changes:
 libgnucash/engine/test/utest-Account.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)



More information about the gnucash-changes mailing list