int main (int argc, char **argv) { int i; qof_init(); g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING ); xaccLogDisable (); /* Always start from the same random seed so we fail consistently */ srand(0); if (!cashobjects_register()) { failure("can't register cashbojects"); goto cleanup; } /* Loop the test. */ for (i = 0; i < 10; i++) { run_test (); } success("queries seem to work"); cleanup: qof_close(); return get_rv(); }
int main (int argc, char** argv) { QofSession* session; qof_init (); cashobjects_register (); session = qof_session_new (); sixbook = qof_session_get_book (session); if (argc > 1) { test_files_in_dir (argc, argv, test_real_account, gnc_account_sixtp_parser_create (), "gnc:account", sixbook); } else { test_generation (); } qof_session_destroy (session); print_test_results (); qof_close (); exit (get_rv ()); }
int main (int argc, char** argv) { qof_init (); cashobjects_register (); xaccLogDisable (); gnc_transaction_xml_v2_testing = TRUE; book = qof_book_new (); if (argc > 1) { test_files_in_dir (argc, argv, test_real_transaction, gnc_transaction_sixtp_parser_create (), "gnc:transaction", book); } else { test_transaction (); } print_test_results (); qof_close (); exit (get_rv ()); }
int main (int argc, char **argv) { gint i; qof_init(); if (!cashobjects_register()) exit(1); /* Any tests that cause an error or warning to be printed * automatically fail! */ g_log_set_always_fatal((GLogLevelFlags)(G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)); /* Set up a reproducible test-case */ srand(0); /* Iterate the test a number of times */ for (i = 0; i < max_iterate; i++) { fprintf(stdout, " Lots: %d of %d paired tests . . . \r", (i + 1) * 2, max_iterate * 2); fflush(stdout); run_test (); } /* 'erase' the recurring tag line with dummy spaces. */ fprintf(stdout, "Lots: Test series complete. \n"); fflush(stdout); print_test_results(); qof_close(); return get_rv(); }
int main (int argc, const char *argv[]) { QofSession *original; guint counter; qof_init (); mygrandRegister(); myparentRegister(); mychildRegister(); for (counter = 0; counter < 35; counter++) { original = qof_session_new(); if (debug) { /* FIXME XML backend can't handle STDOUT * qof_session_begin(original, QOF_STDOUT, TRUE, FALSE); */ } create_data(original, (counter % 5)); test_recursion(original, (counter % 5)); qof_session_end(original); } print_test_results(); qof_close(); return EXIT_SUCCESS; }
int main (int argc, char ** argv) { gchar* filename; QofSession* session_1; qof_init(); cashobjects_register(); qof_load_backend_library ("../.libs/", GNC_LIB_NAME); // Create a session with data session_1 = create_session(); filename = tempnam( "/tmp", "test-sqlite3-" ); printf( "Using filename: %s\n", filename ); test_dbi_store_and_reload( "sqlite3", session_1, filename ); #if 0 printf( "TEST_MYSQL_URL='%s'\n", TEST_MYSQL_URL ); if ( strlen( TEST_MYSQL_URL ) > 0 ) { session_1 = create_session(); test_dbi_store_and_reload( "mysql", session_1, TEST_MYSQL_URL ); } printf( "TEST_PGSQL_URL='%s'\n", TEST_PGSQL_URL ); if ( strlen( TEST_PGSQL_URL ) > 0 ) { session_1 = create_session(); test_dbi_store_and_reload( "pgsql", session_1, TEST_PGSQL_URL ); } #endif print_test_results(); qof_close(); exit(get_rv()); }
static void gnc_engine_init_part1() { /* initialize QOF */ qof_init(); /* Now register our core types */ cashobjects_register(); }
int main (int argc, char ** argv) { const char *location = g_getenv("GNC_TEST_FILES"); int files_tested = 0; GDir *xml2_dir; qof_init(); cashobjects_register(); do_test(qof_load_backend_library ("../.libs/", GNC_LIB_NAME), " loading gnc-backend-xml GModule failed"); if (!location) { location = "test-files/xml2"; } xaccLogDisable(); if ((xml2_dir = g_dir_open(location, 0, NULL)) == NULL) { failure("unable to open xml2 directory"); } else { const gchar *entry; while ((entry = g_dir_read_name(xml2_dir)) != NULL) { if (g_str_has_suffix(entry, ".gml2")) { gchar *to_open = g_build_filename(location, entry, (gchar*)NULL); if (!g_file_test(to_open, G_FILE_TEST_IS_DIR)) { test_load_file(to_open); files_tested++; } g_free(to_open); } } } g_dir_close(xml2_dir); if (files_tested == 0) { failure("handled 0 files in test-load-xml2"); } print_test_results(); qof_close(); exit(get_rv()); }
static void gnc_engine_init_part1() { if (1 == engine_is_initialized) return; /* initialize QOF */ qof_init(); qof_set_alt_dirty_mode(TRUE); /* Now register our core types */ cashobjects_register(); }
int main (int argc, char **argv) { qof_init(); if (cashobjects_register()) { test_address(); print_test_results(); } qof_close(); return get_rv(); }
int main (int argc, char **argv) { qof_init(); if (cashobjects_register()) { xaccLogDisable (); run_test (); print_test_results(); } qof_close(); return get_rv(); }
int main (int argc, char **argv) { qof_init(); do_test (gncInvoiceRegister(), "Cannot register GncInvoice"); do_test (gncJobRegister (), "Cannot register GncJob"); do_test (gncCustomerRegister(), "Cannot register GncCustomer"); do_test (gncVendorRegister(), "Cannot register GncVendor"); test_vendor(); print_test_results(); qof_close(); return get_rv(); }
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 */ g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */ test_suite_gnc_backend_sql (); return g_test_run( ); }
int main (int argc, char **argv) { qof_init(); do_test (gncInvoiceRegister(), "Cannot register GncInvoice"); do_test (gncJobRegister (), "Cannot register GncJob"); do_test (gncCustomerRegister(), "Cannot register GncCustomer"); do_test (gncEmployeeRegister(), "Cannot register GncEmployee"); test_employee(); print_test_results(); qof_close(); return 0; }
int main (int argc, char** argv) { qof_init (); cashobjects_register (); //qof_log_init_filename("/tmp/gnctest.trace"); //qof_log_set_default(QOF_LOG_DETAIL); //qof_log_set_level(GNC_MOD_PRICE, QOF_LOG_DETAIL); session = qof_session_new (); test_generation (); print_test_results (); qof_close (); exit (get_rv ()); }
int main() { qof_log_init(); qof_init(); gnc_module_system_init(); char * no_args[1] = { NULL }; gnc_engine_init(0, no_args); QofSession * s = qof_session_new(); qof_session_begin(s, "sqlite3:///tmp/blah.gnucash", 0, 1, 0); qof_session_load(s, NULL); qof_session_save(s, NULL); qof_session_end(s); return 0; }
int main (int argc, char **argv) { qof_init(); g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING ); #if 0 set_success_print(TRUE); #endif test_main(); print_test_results(); return get_rv(); }
int main (int argc, char* argv[]) { qof_init (); /* equally initializes gobject system */ qof_log_init_filename_special ("stderr"); /* Init the log system */ g_test_init (&argc, &argv, NULL); /* initialize test program */ g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */ cashobjects_register (); g_assert (qof_load_backend_library ("../.libs/", GNC_LIB_NAME)); g_assert (qof_load_backend_library ("../../xml/.libs", "gncmod-backend-xml")); test_suite_gnc_backend_dbi (); return g_test_run (); }
int main (int argc, char **argv) { qof_init(); do_test (cashobjects_register(), "Cannot register cash objects"); /* These three registrations are done during cashobjects_register, so trying to register them again naturally fails. */ #if 0 do_test (gncInvoiceRegister(), "Cannot register GncInvoice"); do_test (gncJobRegister (), "Cannot register GncJob"); do_test (gncCustomerRegister(), "Cannot register GncCustomer"); #endif test_customer(); print_test_results(); qof_close (); return get_rv(); }
int main() { const char* testurl = "sqlite3://" TESTFILE; qof_log_init(); qof_init(); gnc_module_system_init(); char * no_args[1] = { NULL }; gnc_engine_init(0, no_args); QofSession * s = qof_session_new(); qof_session_begin(s, testurl, 0, 1, 0); qof_session_load(s, NULL); qof_session_save(s, NULL); qof_session_end(s); unlink(TESTFILE); return 0; }
int main (int argc, char *argv[]) { qof_init(); /* You may or may not need this, depending on * whether the module you're testing or any * dependencies use GObject. */ qof_log_init_filename_special("/dev/null"); /* Initialize the * gnucash logging system. Your tests will * crash on the first logging call otherwise */ g_test_init ( &argc, &argv, NULL ); /* initialize test program */ test_suite_module1(); /* Call each suite assembly function */ test_suite_module2(); test_suite_module3(); test_suite_module4(); return g_test_run(); /* Run the result */ }
int main(int argc, char **argv) { int i; qof_init(); for (i = 0; strs[i].input != NULL; i++) { char *daout; char *dain; char *wantout; if (strs[i].prefix_home == 1) { dain = g_build_filename(g_get_home_dir(), strs[i].input, (gchar *)NULL); wantout = g_build_filename(g_get_home_dir(), strs[i].output, (gchar *)NULL); } else if (strs[i].prefix_home == 2) { dain = g_strdup(strs[i].input); wantout = g_build_filename(g_get_home_dir(), strs[i].output, (gchar *)NULL); } else { dain = g_strdup(strs[i].input); wantout = g_strdup(strs[i].output); } daout = gnc_resolve_file_path(dain); do_test_args(g_strcmp0(daout, wantout) == 0, "gnc_resolve_file_path", __FILE__, __LINE__, "%s (%s) vs %s", daout, dain, wantout); g_free(dain); g_free(wantout); g_free(daout); } print_test_results(); return get_rv(); }
int main(int argc, char **argv) { qof_init(); cashobjects_register(); test_dom_tree_to_guid(); fflush(stdout); test_dom_tree_to_commodity_ref(); fflush(stdout); test_dom_tree_to_text(); fflush(stdout); test_dom_tree_to_timespec(); fflush(stdout); test_dom_tree_to_gnc_numeric(); fflush(stdout); print_test_results(); qof_close(); exit(get_rv()); }
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 */ // g_log_set_always_fatal (0); g_test_bug_base("https://bugzilla.gnome.org/show_bug.cgi?id="); /* init the bugzilla URL */ test_suite_gnc_guid(); test_suite_qofbook(); test_suite_qofinstance(); test_suite_kvp_frame(); test_suite_qofobject(); test_suite_qofsession(); test_suite_gnc_date(); test_suite_qof_string_cache(); return g_test_run( ); }
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(); test_suite_account(); test_suite_budget(); test_suite_gncEntry(); test_suite_gncInvoice(); test_suite_transaction(); test_suite_split(); test_suite_engine_kvp_properties (); return g_test_run( ); }
int main(int argc, char **argv) { int i; qof_init(); /* TEST: gnc_uri_get_components */ for (i = 0; strs[i].uri != NULL; i++) { gchar *tprotocol = NULL; gchar *thostname = NULL; gchar *tusername = NULL; gchar *tpassword = NULL; gchar *tpath = NULL; gint32 tport = 0; gboolean testresult; gnc_uri_get_components( strs[i].uri, &tprotocol, &thostname, &tport, &tusername, &tpassword, &tpath ); testresult = ( safe_strcmp ( tprotocol, strs[i].protocol ) == 0 ) & ( safe_strcmp ( thostname, strs[i].hostname ) == 0 ) & ( safe_strcmp ( tusername, strs[i].username ) == 0 ) & ( safe_strcmp ( tpassword, strs[i].password ) == 0 ) & ( safe_strcmp ( tpath, strs[i].path ) == 0 ) & ( tport == strs[i].port ); do_test_args(testresult, "gnc_uri_get_components", __FILE__, __LINE__, "\n %s:\n" " Expected: %s, %s, %s, %s, %s, %d\n" " Got : %s, %s, %s, %s, %s, %d\n", strs[i].uri, strs[i].protocol, strs[i].hostname, strs[i].username, strs[i].password, strs[i].path, strs[i].port, tprotocol, thostname, tusername, tpassword, tpath, tport); g_free(tprotocol); g_free(thostname); g_free(tusername); g_free(tpassword); g_free(tpath); } /* TEST: gnc_uri_get_protocol */ for (i = 0; strs[i].uri != NULL; i++) { gchar *tprotocol = NULL; gboolean testresult; tprotocol = gnc_uri_get_protocol( strs[i].uri ); testresult = ( safe_strcmp ( tprotocol, strs[i].protocol ) == 0 ); do_test_args(testresult, "gnc_uri_get_protocol", __FILE__, __LINE__, "\n %s:\n" " Expected: %s\n" " Got : %s\n", strs[i].uri, strs[i].protocol, tprotocol ); g_free(tprotocol); } /* TEST: gnc_uri_get_path */ for (i = 0; strs[i].uri != NULL; i++) { gchar *tpath = NULL; gboolean testresult; tpath = gnc_uri_get_path( strs[i].uri ); testresult = ( safe_strcmp ( tpath, strs[i].path ) == 0 ); do_test_args(testresult, "gnc_uri_get_path", __FILE__, __LINE__, "\n %s:\n" " Expected: %s\n" " Got : %s\n", strs[i].uri, strs[i].path, tpath ); g_free(tpath); } /* TEST: gnc_uri_create_uri */ for (i = 0; strs[i].uri != NULL; i++) { gchar *turi = NULL; gboolean testresult; turi = gnc_uri_create_uri( strs[i].protocol, strs[i].hostname, strs[i].port, strs[i].username, strs[i].password, strs[i].path ); testresult = ( safe_strcmp ( turi, strs[i].created_uri ) == 0 ); do_test_args(testresult, "gnc_uri_create_uri", __FILE__, __LINE__, "\n %s, %s, %s, %s, %s, %d:\n" " Expected: %s\n" " Got : %s\n", strs[i].protocol, strs[i].hostname, strs[i].username, strs[i].password, strs[i].path, strs[i].port, strs[i].created_uri, turi); g_free(turi); } /* TEST: gnc_uri_normalize_uri */ for (i = 0; strs[i].uri != NULL; i++) { gchar *turi = NULL; gboolean testresult; turi = gnc_uri_normalize_uri( strs[i].uri, strs[i].want_password ); testresult = ( safe_strcmp ( turi, strs[i].normalized_uri ) == 0 ); do_test_args(testresult, "gnc_uri_normalize_uri", __FILE__, __LINE__, "\n %s:\n" " Expected: %s\n" " Got : %s\n", strs[i].uri, strs[i].normalized_uri, turi ); g_free(turi); } /* TEST: gnc_uri_is_file_protocol */ for (i = 0; strs[i].uri != NULL; i++) { gboolean tis_file_protocol; gboolean testresult; tis_file_protocol = gnc_uri_is_file_protocol( strs[i].protocol ); testresult = ( tis_file_protocol == strs[i].is_file_protocol ); do_test_args(testresult, "gnc_uri_is_file_protocol", __FILE__, __LINE__, "\n %s:\n" " Expected: %s\n" " Got : %s\n", strs[i].uri, strs[i].is_file_protocol, tis_file_protocol ); } /* TEST: gnc_uri_is_file_uri */ for (i = 0; strs[i].uri != NULL; i++) { gboolean tis_file_uri; gboolean testresult; tis_file_uri = gnc_uri_is_file_uri( strs[i].uri ); testresult = ( tis_file_uri == strs[i].is_file_protocol ); do_test_args(testresult, "gnc_uri_is_file_uri", __FILE__, __LINE__, "\n %s:\n" " Expected: %s\n" " Got : %s\n", strs[i].uri, strs[i].is_file_protocol, tis_file_uri ); } print_test_results(); return get_rv(); }