From: <ste...@us...> - 2013-05-18 02:44:53
|
Revision: 3929 http://sourceforge.net/p/moneymanagerex/code/3929 Author: stef145g Date: 2013-05-18 02:44:50 +0000 (Sat, 18 May 2013) Log Message: ----------- Introducing displayTimeTaken using wxStopWatch. Modified Paths: -------------- trunk/mmex/src/tests/dbwrapper_test.cpp trunk/mmex/src/tests/testing_util.cpp trunk/mmex/src/tests/testing_util.h Modified: trunk/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- trunk/mmex/src/tests/dbwrapper_test.cpp 2013-05-17 19:07:13 UTC (rev 3928) +++ trunk/mmex/src/tests/dbwrapper_test.cpp 2013-05-18 02:44:50 UTC (rev 3929) @@ -70,7 +70,7 @@ TEST(ViewExists) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); @@ -93,7 +93,7 @@ TEST(init_DB) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); CHECK(pCore->displayDatabaseError_ == true); @@ -134,7 +134,7 @@ TEST(addBudgetYear) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -150,7 +150,7 @@ TEST(getBudgetYearID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, "unknown_year"); @@ -164,7 +164,7 @@ TEST(getBudgetYearForID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -178,7 +178,7 @@ TEST(updateYearForID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -201,7 +201,7 @@ TEST(copyBudgetYear) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); int base_year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -230,7 +230,7 @@ TEST(deleteBudgetYear) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); bool deleted = mmDBWrapper::deleteBudgetYear(pDb, "wrong_year"); @@ -244,7 +244,7 @@ TEST(addCategory) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.AddCategory(g_CategName); @@ -258,7 +258,7 @@ TEST(addSubCategory) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -274,7 +274,7 @@ TEST(getCategoryID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -288,7 +288,7 @@ TEST(getSubCategoryID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -305,7 +305,7 @@ TEST(getCategoryName) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -322,7 +322,7 @@ TEST(getSubCategoryName) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -342,7 +342,7 @@ TEST(updateCategory) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.GetCategoryId(g_CategName); @@ -380,7 +380,7 @@ TEST(deleteSubCategoryWithConstraints) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -398,7 +398,7 @@ TEST(deleteCategoryWithConstraints) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -413,7 +413,7 @@ TEST(getCurrencyID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -427,7 +427,7 @@ TEST(getCurrencyName) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -446,7 +446,7 @@ TEST(setBaseCurrencySettings) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -462,7 +462,7 @@ TEST(getBaseCurrencySettings) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -476,7 +476,7 @@ TEST(loadBaseCurrencySettings) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); pCore->currencyList_.LoadBaseCurrencySettings(); @@ -505,7 +505,7 @@ TEST(load_Currency_Settings) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -519,7 +519,7 @@ TEST(setInfoSettingValue) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); const wxString name = "settings name"; @@ -536,7 +536,7 @@ TEST(getInfoSettingValue) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); const wxString name = "wrong name"; @@ -557,7 +557,7 @@ TEST(addPayee) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int added = pCore->categoryList_.AddCategory(g_CategName); @@ -587,7 +587,7 @@ TEST(getPayeeID) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); @@ -612,7 +612,7 @@ TEST(getPayee) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); @@ -633,7 +633,7 @@ TEST(updatePayee) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int payee_id = pCore->payeeList_.GetPayeeId(g_PayeeName); @@ -675,7 +675,7 @@ TEST(getAmountForPayee) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); @@ -695,7 +695,7 @@ TEST(delete_Payee) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); @@ -718,7 +718,7 @@ TEST(getNumAccounts) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int cnt = pCore->accountList_.getNumAccounts(); @@ -729,7 +729,7 @@ TEST(add_new_transactions) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int trans_list_size = pCore->bTransactionList_.transactions_.size(); @@ -816,7 +816,7 @@ TEST(copy_paste_transactions) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; mmCoreDB* pCore = pDb_core().get(); int account_id = 1; @@ -864,7 +864,7 @@ #if 1 TEST(New_INIDB_TEST_1) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; const wxString TEST_NAME_BOOL = "Test 1 BOOL"; const wxString TEST_NAME_INT = "Test 1 INTEGER"; @@ -890,7 +890,7 @@ #if 1 TEST(New_INIDB_TEST_2) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; const wxString TEST_NAME_BOOL = "Test 2 BOOL"; const wxString TEST_NAME_INT = "Test 2 INTEGER"; @@ -919,7 +919,7 @@ #if 1 TEST(New_INIDB_TEST_3) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; const wxString TEST_NAME_BOOL = "Test 3 BOOL"; const wxString TEST_NAME_INT = "Test 3 INTEGER"; @@ -964,7 +964,7 @@ #if 1 TEST(New_INIDB_TEST_4) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; std::shared_ptr<wxSQLite3Database> pInidb = get_pInidb(); MMEX_IniSettings* pSettings = pSettingsList().get(); @@ -987,7 +987,7 @@ #if 1 TEST(New_INIDB_TEST_5) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; MMEX_IniSettings* pSettings = pSettingsList().get(); pSettings->Load(); @@ -1008,7 +1008,7 @@ #if 1 TEST(New_INFO_DB_TEST_1) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; // Using the details from the master table database std::shared_ptr<wxSQLite3Database> pdb = get_pDb(); @@ -1034,7 +1034,7 @@ #if 1 TEST(New_INFO_DB_TEST_2) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; // Using the details from the global ini database std::shared_ptr<wxSQLite3Database> pdb = get_pInidb(); @@ -1060,7 +1060,7 @@ #if 1 TEST(New_INFO_DB_TEST_3) { - const wxDateTime start_time(wxDateTime::UNow()); + wxStopWatch start_time; // Save the details in the main database std::shared_ptr<wxSQLite3Database> pdb = get_pDb(); Modified: trunk/mmex/src/tests/testing_util.cpp =================================================================== --- trunk/mmex/src/tests/testing_util.cpp 2013-05-17 19:07:13 UTC (rev 3928) +++ trunk/mmex/src/tests/testing_util.cpp 2013-05-18 02:44:50 UTC (rev 3929) @@ -138,7 +138,7 @@ } /*****************************************************************************************/ -void const displayTimeTaken(const wxString msg, const wxDateTime start_time) +void const displayTimeTaken(const wxString& msg, const wxDateTime start_time) { const wxDateTime end_time(wxDateTime::UNow()); const wxString time_dif = (end_time - start_time).Format("%S%l"); @@ -147,6 +147,11 @@ } /*****************************************************************************************/ +void const displayTimeTaken(const wxString& msg, const wxStopWatch& start_time) +{ + printf(wxString::Format("Time Taken: %.5d milliseconds - Test: %s \n", start_time.Time(), msg.c_str()).char_str()); +} + void display_STD_IO_separation_line() { printf("\n___________________________________________________________________\n"); Modified: trunk/mmex/src/tests/testing_util.h =================================================================== --- trunk/mmex/src/tests/testing_util.h 2013-05-17 19:07:13 UTC (rev 3928) +++ trunk/mmex/src/tests/testing_util.h 2013-05-18 02:44:50 UTC (rev 3929) @@ -82,7 +82,10 @@ // Create a single access point for the main database, stored in memory. std::shared_ptr<mmCoreDB> pDb_core(); -void const displayTimeTaken(const wxString msg, const wxDateTime start_time); +// Deprecated: Use displayTimeTaken(...) using wxStopWatch +void const displayTimeTaken(const wxString& msg, const wxDateTime start_time); +// Display a message string displaying time taken on a console +void const displayTimeTaken(const wxString& msg, const wxStopWatch& start_time); void display_STD_IO_separation_line(); void display_STD_IO_line(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |