From 85db341afe0211b9be71a2ba678a106048cbd18f Mon Sep 17 00:00:00 2001 From: John Ralls Date: Wed, 8 Apr 2020 12:05:19 -0700 Subject: [PATCH] Remove test-option-utils It no longer works. Since that's all that test-app-utils called, delete it too. --- libgnucash/app-utils/test/CMakeLists.txt | 2 - libgnucash/app-utils/test/test-app-utils.c | 54 ------- .../app-utils/test/test-option-util.cpp | 137 ------------------ 3 files changed, 193 deletions(-) delete mode 100644 libgnucash/app-utils/test/test-app-utils.c delete mode 100644 libgnucash/app-utils/test/test-option-util.cpp diff --git a/libgnucash/app-utils/test/CMakeLists.txt b/libgnucash/app-utils/test/CMakeLists.txt index eb6b27c0e3..7b2568e5bf 100644 --- a/libgnucash/app-utils/test/CMakeLists.txt +++ b/libgnucash/app-utils/test/CMakeLists.txt @@ -12,8 +12,6 @@ set(APP_UTILS_TEST_INCLUDE_DIRS set(APP_UTILS_TEST_LIBS gnc-app-utils gnc-test-engine test-core ${GIO_LDFLAGS} ${GUILE_LDFLAGS}) -set(test_app_utils_SOURCES test-app-utils.c test-option-util.cpp) - macro(add_app_utils_test _TARGET _SOURCE_FILES) gnc_add_test(${_TARGET} "${_SOURCE_FILES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS) endmacro() diff --git a/libgnucash/app-utils/test/test-app-utils.c b/libgnucash/app-utils/test/test-app-utils.c deleted file mode 100644 index ae63a01cf2..0000000000 --- a/libgnucash/app-utils/test/test-app-utils.c +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** - * test-app-utils.c: GLib g_test test execution file. * - * Copyright 2013 John Ralls * - * * - * 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@gnu.org * -\********************************************************************/ - -#include -#include -#include -#include - -extern void test_suite_option_util (void); -extern void test_suite_gnc_ui_util (void); - -static void -guile_main (void *closure, int argc, char **argv) -{ - int retval; - scm_c_use_module("gnucash app-utils"); - - test_suite_option_util (); - retval = g_test_run (); - - exit (retval); -} - -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://bugs.gnucash.org/show_bug.cgi?id="); /* init the bugzilla URL */ - g_setenv ("GNC_UNINSTALLED", "1", TRUE); - scm_boot_guile (argc, argv, guile_main, NULL); - return 0; -} diff --git a/libgnucash/app-utils/test/test-option-util.cpp b/libgnucash/app-utils/test/test-option-util.cpp deleted file mode 100644 index c4b1c0c40b..0000000000 --- a/libgnucash/app-utils/test/test-option-util.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************** - * test-option-util.cpp: GLib test suite for option-util.c. * - * Copyright 2013 John Ralls * - * * - * 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 * - * https://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@gnu.org * - ********************************************************************/ -#include -#include -#include -#include - -extern "C" -{ -#include -#include -#include "test-engine-stuff.h" -#include "../option-util.h" -} - -static const gchar *suitename = "/app-utils/option-util"; -extern "C" void test_suite_option_util (void); - -typedef struct -{ - QofBook *book; - GSList *hdlrs; -} Fixture; - -/* Expose a mostly-private QofInstance function to load options into - * the Book. - */ -extern "C" KvpFrame *qof_instance_get_slots (const QofInstance*); - -static void -setup (Fixture *fixture, gconstpointer pData) -{ - fixture->book = qof_book_new (); - fixture->hdlrs = NULL; -} - -static void -setup_kvp (Fixture *fixture, gconstpointer pData) -{ - QofBook *book; - KvpFrame *slots; - setup (fixture, pData); - book = fixture->book; - slots = qof_instance_get_slots (QOF_INSTANCE (book)); - qof_begin_edit (QOF_INSTANCE (book)); - qof_instance_set (QOF_INSTANCE (book), - "trading-accts", "t", - "split-action-num-field", "t", - "autoreadonly-days", (double)21, - NULL); - - slots->set_path({"options", "Business", "Company Name"}, - new KvpValue(g_strdup ("Bogus Company"))); - qof_commit_edit (QOF_INSTANCE (book)); -} - -static void -teardown (Fixture *fixture, gconstpointer pData) -{ - qof_book_destroy (fixture->book); - g_slist_free_full (fixture->hdlrs, test_free_log_handler); - test_clear_error_list(); -} - -static void -test_option_load (Fixture *fixture, gconstpointer pData) -{ - gchar *str = NULL; - SCM symbol_value; - QofBook *book = fixture->book; - GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK); - - qof_book_load_options (book, gnc_option_db_load, odb); - g_assert (gnc_option_db_lookup_boolean_option (odb, OPTION_SECTION_ACCOUNTS, OPTION_NAME_TRADING_ACCOUNTS, FALSE)); - g_assert (gnc_option_db_lookup_boolean_option (odb, - OPTION_SECTION_ACCOUNTS, - OPTION_NAME_NUM_FIELD_SOURCE, FALSE)); - g_assert_cmpstr (gnc_option_db_lookup_string_option (odb, "Business", "Company Name", FALSE), ==, "Bogus Company"); - g_assert_cmpfloat (gnc_option_db_lookup_number_option (odb, OPTION_SECTION_ACCOUNTS, OPTION_NAME_AUTO_READONLY_DAYS, FALSE), ==, 21); - - gnc_option_db_destroy (odb); -} - -static void -test_option_save (Fixture *fixture, gconstpointer pData) -{ - QofBook *book = fixture->book; - GNCOptionDB *odb = gnc_option_db_new_for_type (QOF_ID_BOOK); - KvpFrame *slots = qof_instance_get_slots (QOF_INSTANCE (book)); - - g_assert (gnc_option_db_set_boolean_option (odb, OPTION_SECTION_ACCOUNTS, - OPTION_NAME_TRADING_ACCOUNTS, - TRUE)); - g_assert (gnc_option_db_set_boolean_option (odb, OPTION_SECTION_ACCOUNTS, - OPTION_NAME_NUM_FIELD_SOURCE, - TRUE)); - g_assert (gnc_option_db_set_string_option (odb, "Business", "Company Name", - "Bogus Company")); - g_assert (gnc_option_db_set_number_option (odb, OPTION_SECTION_ACCOUNTS, - OPTION_NAME_AUTO_READONLY_DAYS, - 17)); - qof_book_save_options (book, gnc_option_db_save, odb, TRUE); - g_assert_cmpstr (slots->get_slot({"options", "Accounts", "Use Trading Accounts"})->get(), == , "t"); - g_assert_cmpstr (slots->get_slot({"options", "Accounts", "Use Split Action Field for Number"})->get(), == , "t"); - g_assert_cmpstr (slots->get_slot({"options", "Business", "Company Name"})->get(), ==, "Bogus Company"); - g_assert_cmpfloat (slots->get_slot({"options", "Accounts", "Day Threshold for Read-Only Transactions (red line)"})->get(), ==, 17); - - gnc_option_db_destroy (odb); -} - -extern "C" void -test_suite_option_util (void) -{ - GNC_TEST_ADD (suitename, "Option DB Load", Fixture, NULL, setup_kvp, test_option_load, teardown); - GNC_TEST_ADD (suitename, "Option DB Save", Fixture, NULL, setup, test_option_save, teardown); -}