From: <ste...@us...> - 2012-07-07 23:48:25
|
Revision: 2705 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2705&view=rev Author: stef145g Date: 2012-07-07 23:48:18 +0000 (Sat, 07 Jul 2012) Log Message: ----------- Branch 0.9.9.0: Update Tests to act as a reference point to restore all tests Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-07 23:41:11 UTC (rev 2704) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-07 23:48:18 UTC (rev 2705) @@ -266,6 +266,7 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- +#if 0 TEST(addCategory) { wxSQLite3Database &db = getDb(); @@ -471,6 +472,7 @@ CHECK(base_id == id); } //---------------------------------------------------------------------------- +#endif TEST(loadBaseCurrencySettings) { @@ -481,6 +483,7 @@ } //---------------------------------------------------------------------------- +#if 0 TEST(getCurrencyBaseConvRate) { wxSQLite3Database &db = getDb(); @@ -502,6 +505,7 @@ mmDBWrapper::loadSettings(&db, id); } +#endif //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- @@ -538,6 +542,7 @@ //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- +#if 0 TEST(addPayee) { wxSQLite3Database &db = getDb(); @@ -665,7 +670,6 @@ // CHECK(amt == 0.0); } //---------------------------------------------------------------------------- - TEST(deletePayeeWithConstraints) { wxSQLite3Database &db = getDb(); @@ -698,7 +702,7 @@ CHECK(!cnt); } //---------------------------------------------------------------------------- - +#endif } // SUITE //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-07-08 05:34:25
|
Revision: 2706 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2706&view=rev Author: stef145g Date: 2012-07-08 05:34:18 +0000 (Sun, 08 Jul 2012) Log Message: ----------- Branch 0.9.9.0: Update tests to all working - Tests now using mixture of dbCore and direct db access. Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-07 23:48:18 UTC (rev 2705) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-08 05:34:18 UTC (rev 2706) @@ -16,19 +16,21 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ********************************************************/ +/************************************************************************* + Revision of last commit: $Revision$ + Author of last commit: $Author$ +**************************************************************************/ + //---------------------------------------------------------------------------- #include <UnitTest++.h> #include <boost/scoped_ptr.hpp> +#include <wx/filename.h> //---------------------------------------------------------------------------- #include "dbwrapper.h" #include "utils.h" +#include "mmcoredb.h" //---------------------------------------------------------------------------- -#include <wx/filename.h> -//---------------------------------------------------------------------------- -namespace -{ - const wxString g_BudgetYear = wxT("2009"); const wxString g_CategName = wxT("new category"); const wxString g_SubCategName= wxT("new subcategory"); @@ -36,6 +38,10 @@ const wxString g_PayeeName = wxT("Payee #1"); //---------------------------------------------------------------------------- +/* + These tests create a new database which is used for the tests. + This class Structure is used to remove the temporary database. +*/ struct Cleanup { ~Cleanup(); @@ -49,6 +55,7 @@ } //---------------------------------------------------------------------------- +// Destructor of the Structure Cleanup::~Cleanup() { try { @@ -59,35 +66,41 @@ } //---------------------------------------------------------------------------- -wxSQLite3Database& getDb() +boost::shared_ptr<wxSQLite3Database> get_pDb() { - static Cleanup dummy; - static wxSQLite3Database db; + static Cleanup temp_database; + static boost::shared_ptr<wxSQLite3Database> pDb(new wxSQLite3Database); - if (!db.IsOpen()) + if (!pDb->IsOpen()) { wxString path = getDbPath(); wxRemoveFile(path); - db.Open(path); - CHECK(db.IsOpen()); + pDb->Open(path); + CHECK(pDb->IsOpen()); } - return db; + return pDb; } //---------------------------------------------------------------------------- -} // namespace +boost::shared_ptr<mmCoreDB> pDb_core() +{ + static boost::shared_ptr<mmCoreDB> pCore(new mmCoreDB(get_pDb())); + return pCore; +} //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- + SUITE(dbwrapper) { TEST(wxSQLite3Exception) { - wxSQLite3Database &db = getDb(); - CHECK_THROW(db.ExecuteUpdate("update bad_table set bad_col = unknown_value"), wxSQLite3Exception); + wxSQLite3Database* db = get_pDb().get(); + CHECK_THROW(db->ExecuteUpdate("update bad_table set bad_col = unknown_value"), wxSQLite3Exception); } //---------------------------------------------------------------------------- @@ -121,298 +134,300 @@ TEST(ViewExists) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - bool ok = mmDBWrapper::ViewExists(&db, "I'm_not_exists"); + bool ok = mmDBWrapper::ViewExists(pDb, "I'm_not_exists"); CHECK(!ok); - db.ExecuteUpdate("create view master_view as " - "select * " - "from sqlite_master" - ); + pDb->ExecuteUpdate("create view master_view as " + "select * " + "from sqlite_master" + ); - ok = mmDBWrapper::ViewExists(&db, "master_view"); + ok = mmDBWrapper::ViewExists(pDb, "master_view"); CHECK(ok); - db.ExecuteUpdate("drop view master_view"); + pDb->ExecuteUpdate("drop view master_view"); } //---------------------------------------------------------------------------- TEST(initDB) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - mmDBWrapper::initDB(&db, 0); + mmDBWrapper::initDB(pDb, 0); CHECK(true); } //---------------------------------------------------------------------------- TEST(getCurrencySymbol) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - wxString s = mmDBWrapper::getCurrencySymbol(&db, 1); + wxString s = mmDBWrapper::getCurrencySymbol(pDb, 1); CHECK(s == L"USD"); - s = mmDBWrapper::getCurrencySymbol(&db, 0); + s = mmDBWrapper::getCurrencySymbol(pDb, 0); CHECK(s.empty()); } //---------------------------------------------------------------------------- TEST(checkDBVersion) { - wxSQLite3Database &db = getDb(); - bool ok = mmDBWrapper::checkDBVersion(&db); + wxSQLite3Database* pDb = get_pDb().get(); + bool ok = mmDBWrapper::checkDBVersion(pDb); CHECK(ok); } //---------------------------------------------------------------------------- TEST(addBudgetYear) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - int year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id == -1); - mmDBWrapper::addBudgetYear(&db, g_BudgetYear); + mmDBWrapper::addBudgetYear(pDb, g_BudgetYear); - year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); } //---------------------------------------------------------------------------- TEST(getBudgetYearID) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - int year_id = mmDBWrapper::getBudgetYearID(&db, wxT("unknown_year")); + int year_id = mmDBWrapper::getBudgetYearID(pDb, wxT("unknown_year")); CHECK(year_id == -1); - year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); } //---------------------------------------------------------------------------- TEST(getBudgetYearForID) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - int year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); - wxString year = mmDBWrapper::getBudgetYearForID(&db, year_id); + wxString year = mmDBWrapper::getBudgetYearForID(pDb, year_id); CHECK(year == g_BudgetYear); } //---------------------------------------------------------------------------- TEST(updateYearForID) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - int year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); wxString new_year = g_BudgetYear + g_BudgetYear; - mmDBWrapper::updateYearForID(&db, new_year, year_id); + mmDBWrapper::updateYearForID(pDb, new_year, year_id); - wxString year = mmDBWrapper::getBudgetYearForID(&db, year_id); + wxString year = mmDBWrapper::getBudgetYearForID(pDb, year_id); CHECK(year == new_year); // restore original value - mmDBWrapper::updateYearForID(&db, g_BudgetYear, year_id); - year = mmDBWrapper::getBudgetYearForID(&db, year_id); + mmDBWrapper::updateYearForID(pDb, g_BudgetYear, year_id); + year = mmDBWrapper::getBudgetYearForID(pDb, year_id); CHECK(year == g_BudgetYear); } //---------------------------------------------------------------------------- TEST(copyBudgetYear) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - int base_year_id = mmDBWrapper::getBudgetYearID(&db, g_BudgetYear); + int base_year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(base_year_id > 0); // -- - bool ok = mmDBWrapper::copyBudgetYear(&db, base_year_id, base_year_id); + bool ok = mmDBWrapper::copyBudgetYear(pDb, base_year_id, base_year_id); CHECK(!ok); // -- wxString new_year = g_BudgetYear + g_BudgetYear; - mmDBWrapper::addBudgetYear(&db, new_year); + mmDBWrapper::addBudgetYear(pDb, new_year); - int new_year_id = mmDBWrapper::getBudgetYearID(&db, new_year); + int new_year_id = mmDBWrapper::getBudgetYearID(pDb, new_year); CHECK(new_year_id > 0); // -- - ok = mmDBWrapper::copyBudgetYear(&db, new_year_id, base_year_id); + ok = mmDBWrapper::copyBudgetYear(pDb, new_year_id, base_year_id); CHECK(ok); } //---------------------------------------------------------------------------- TEST(deleteBudgetYear) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - bool deleted = mmDBWrapper::deleteBudgetYear(&db, wxT("wrong_year")); + bool deleted = mmDBWrapper::deleteBudgetYear(pDb, wxT("wrong_year")); CHECK(!deleted); - deleted = mmDBWrapper::deleteBudgetYear(&db, g_BudgetYear); + deleted = mmDBWrapper::deleteBudgetYear(pDb, g_BudgetYear); CHECK(deleted); } //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- -#if 0 TEST(addCategory) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - bool added = mmDBWrapper::addCategory(&db, g_CategName); - CHECK(added); + int cat_id = pCore->addCategory(g_CategName); - int id = mmDBWrapper::getCategoryID(&db, g_CategName); - CHECK(id > 0); + int id = pCore->getCategoryID(g_CategName); + + CHECK(id == cat_id); } //---------------------------------------------------------------------------- TEST(addSubCategory) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - bool added = mmDBWrapper::addSubCategory(&db, cat_id, g_SubCategName); - CHECK(added); + int subcat_id = pCore->addSubCategory(cat_id, g_SubCategName); - int id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); - CHECK(id > 0); + int id = pCore->getSubCategoryID(cat_id, g_SubCategName); + CHECK(id == subcat_id); } //---------------------------------------------------------------------------- TEST(getCategoryID) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - cat_id = mmDBWrapper::getCategoryID(&db, wxT("unknown category")); + cat_id = pCore->getCategoryID(wxT("unknown category")); CHECK(cat_id == -1); } //---------------------------------------------------------------------------- TEST(getSubCategoryID) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); - sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, wxT("unknown subcategory")); + sc_id = pCore->getSubCategoryID(cat_id, wxT("unknown subcategory")); CHECK(sc_id == -1); } //---------------------------------------------------------------------------- TEST(getCategoryName) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - wxString name = mmDBWrapper::getCategoryName(&db, cat_id); + wxString name = pCore->getCategoryName(cat_id); CHECK(name == g_CategName); - name = mmDBWrapper::getCategoryName(&db, 0); + name = pCore->getCategoryName(0); CHECK(name.empty()); } //---------------------------------------------------------------------------- TEST(getSubCategoryName) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); - wxString name = mmDBWrapper::getSubCategoryName(&db, cat_id, sc_id); + wxString name = mmDBWrapper::getSubCategoryName(pDb, cat_id, sc_id); CHECK(name == g_SubCategName); - name = mmDBWrapper::getSubCategoryName(&db, cat_id, 0); + name = mmDBWrapper::getSubCategoryName(pDb, cat_id, 0); CHECK(name.empty()); } //---------------------------------------------------------------------------- - TEST(updateCategory) { - wxSQLite3Database &db = getDb(); +// wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); // -- const wxString new_name = wxT("new name"); - bool ok = mmDBWrapper::updateCategory(&db, cat_id, -1, new_name); + bool ok = pCore->updateCategory(cat_id, -1, new_name); CHECK(ok); - wxString name = mmDBWrapper::getCategoryName(&db, cat_id); + wxString name = pCore->getCategoryName(cat_id); CHECK(name == new_name); - ok = mmDBWrapper::updateCategory(&db, cat_id, -1, g_CategName); // restore name + ok = pCore->updateCategory(cat_id, -1, g_CategName); // restore name CHECK(ok); // -- - ok = mmDBWrapper::updateCategory(&db, cat_id, sc_id, new_name); + ok = pCore->updateCategory(cat_id, sc_id, new_name); CHECK(ok); - name = mmDBWrapper::getSubCategoryName(&db, cat_id, sc_id); + name = pCore->GetSubCategoryString(cat_id, sc_id); CHECK(name == new_name); - ok = mmDBWrapper::updateCategory(&db, cat_id, sc_id, g_SubCategName); // restore + ok = pCore->updateCategory(cat_id, sc_id, g_SubCategName); // restore CHECK(ok); } //---------------------------------------------------------------------------- TEST(deleteSubCategoryWithConstraints) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); - bool ok = mmDBWrapper::deleteSubCategoryWithConstraints(&db, cat_id, sc_id); + bool ok = mmDBWrapper::deleteSubCategoryWithConstraints(pDb, cat_id, sc_id); CHECK(ok); } //---------------------------------------------------------------------------- TEST(deleteCategoryWithConstraints) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - bool ok = mmDBWrapper::deleteCategoryWithConstraints(&db, cat_id); + bool ok = mmDBWrapper::deleteCategoryWithConstraints(pDb, cat_id); CHECK(ok); } //---------------------------------------------------------------------------- @@ -420,275 +435,285 @@ TEST(getCurrencyID) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - id = mmDBWrapper::getCurrencyID(&db, wxT("unknown currency")); + id = pCore->getCurrencyID(wxT("unknown currency")); CHECK(id == -1); } //---------------------------------------------------------------------------- TEST(getCurrencyName) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - wxString name = mmDBWrapper::getCurrencyName(&db, id); + wxString name = pCore->getCurrencyName(id); CHECK(name == g_CurrencyName); // -- - name = mmDBWrapper::getCurrencyName(&db, -1); + name = pCore->getCurrencyName(-1); CHECK(name.empty()); } //---------------------------------------------------------------------------- TEST(setBaseCurrencySettings) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - mmDBWrapper::setBaseCurrencySettings(&db, id); + mmDBWrapper::setBaseCurrencySettings(pDb, id); - int base_id = mmDBWrapper::getBaseCurrencySettings(&db); + int base_id = mmDBWrapper::getBaseCurrencySettings(pDb); CHECK(base_id == id); } //---------------------------------------------------------------------------- TEST(getBaseCurrencySettings) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - int base_id = mmDBWrapper::getBaseCurrencySettings(&db); + int base_id = mmDBWrapper::getBaseCurrencySettings(pDb); CHECK(base_id == id); } //---------------------------------------------------------------------------- -#endif TEST(loadBaseCurrencySettings) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); - mmDBWrapper::loadBaseCurrencySettings(&db); + mmDBWrapper::loadBaseCurrencySettings(pDb); CHECK(true); } //---------------------------------------------------------------------------- -#if 0 TEST(getCurrencyBaseConvRate) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - double rate = mmDBWrapper::getCurrencyBaseConvRateForId(&db, id); + double rate = mmDBWrapper::getCurrencyBaseConvRateForId(pDb, id); CHECK(rate != 0.0); } //---------------------------------------------------------------------------- TEST(loadSettings) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = mmDBWrapper::getCurrencyID(&db, g_CurrencyName); + int id = pCore->getCurrencyID(g_CurrencyName); CHECK(id > 0); - mmDBWrapper::loadSettings(&db, id); + mmDBWrapper::loadSettings(pDb, id); } -#endif //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- TEST(setInfoSettingValue) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); const wxString name = wxT("settings name"); const wxString val = wxT("settings value"); - mmDBWrapper::setInfoSettingValue(&db, name, val); + mmDBWrapper::setInfoSettingValue(pDb, name, val); - wxString s = mmDBWrapper::getInfoSettingValue(&db, name, wxT("")); + wxString s = mmDBWrapper::getInfoSettingValue(pDb, name, wxT("")); CHECK(s == val); } //---------------------------------------------------------------------------- TEST(getInfoSettingValue) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); const wxString name = wxT("wrong name"); const wxString defVal = wxT("default value"); - wxString s = mmDBWrapper::getInfoSettingValue(&db, name, defVal); + wxString s = mmDBWrapper::getInfoSettingValue(pDb, name, defVal); CHECK(s == defVal); // -- - mmDBWrapper::setInfoSettingValue(&db, name, defVal); - s = mmDBWrapper::getInfoSettingValue(&db, name, wxT("")); + mmDBWrapper::setInfoSettingValue(pDb, name, defVal); + s = mmDBWrapper::getInfoSettingValue(pDb, name, wxT("")); CHECK(s == defVal); } //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- - -#if 0 TEST(addPayee) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - bool added = mmDBWrapper::addCategory(&db, g_CategName); - CHECK(added); + int added = pCore->addCategory(g_CategName); + CHECK(added > 0); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - added = mmDBWrapper::addSubCategory(&db, cat_id, g_SubCategName); + added = pCore->addSubCategory(cat_id, g_SubCategName); CHECK(added); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); // -- -// mmDBWrapper::addPayee(&db, g_PayeeName, cat_id, sc_id); + int payeeID = pCore->addPayee(g_PayeeName); + mmDBWrapper::updatePayee(pDb, g_PayeeName, payeeID, cat_id, sc_id); + } //---------------------------------------------------------------------------- TEST(getPayeeID) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int cat_id = mmDBWrapper::getCategoryID(&db, g_CategName); + int cat_id = pCore->getCategoryID(g_CategName); CHECK(cat_id > 0); - int sc_id = mmDBWrapper::getSubCategoryID(&db, cat_id, g_SubCategName); + int sc_id = pCore->getSubCategoryID(cat_id, g_SubCategName); CHECK(sc_id > 0); // -- - int id = 0; int cat = 0; int subc = 0; - bool ok = mmDBWrapper::getPayeeID(&db, g_PayeeName, id, cat, subc); - CHECK(ok); + int id = pCore->getPayeeID(g_PayeeName); CHECK(id > 0); + + wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); + CHECK(name = g_PayeeName); + CHECK(cat > 0); CHECK(subc > 0); - // -- - ok = mmDBWrapper::getPayeeID(&db, wxT("bad payee name"), id, cat, subc); - CHECK(!ok); + id = pCore->getPayeeID(wxT("bad payee name")); + CHECK(id < 1); } //---------------------------------------------------------------------------- TEST(getPayee) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = 0; - int cat = 0; - int subc = 0; + int payee_id = pCore->getPayeeID(g_PayeeName); + CHECK(payee_id > 0); - bool ok = mmDBWrapper::getPayeeID(&db, g_PayeeName, id, cat, subc); - CHECK(ok); - // -- - - int cat2 = 0; - int subc2 = 0; - wxString name = mmDBWrapper::getPayee(&db, id, cat2, subc2); + int cat = 0; + int subcat = 0; + wxString name = mmDBWrapper::getPayee(pDb, payee_id, cat, subcat); CHECK(name == g_PayeeName); - CHECK(cat2 == cat); - CHECK(subc2 == subc); + CHECK(cat != 0); + CHECK(subcat != 0); + // -- - name = mmDBWrapper::getPayee(&db, 0, cat, subc); + name = mmDBWrapper::getPayee(pDb, 0, cat, subcat); CHECK(name.empty()); } //---------------------------------------------------------------------------- TEST(updatePayee) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = 0; - int cat = 0; - int subc = 0; + int payee_id = pCore->getPayeeID(g_PayeeName); + CHECK(payee_id > 0); - bool ok = mmDBWrapper::getPayeeID(&db, g_PayeeName, id, cat, subc); - CHECK(ok); + int cat = 0; + int subcat = 0; + wxString payee_name = mmDBWrapper::getPayee(pDb, payee_id, cat, subcat); // -- const wxString new_name = wxT("new payee name"); - ok = mmDBWrapper::updatePayee(&db, new_name, id, cat, -1); + bool ok = mmDBWrapper::updatePayee(pDb, new_name, payee_id, cat, -1); CHECK(ok); // -- int subc2 = 0; - wxString name = mmDBWrapper::getPayee(&db, id, cat, subc2); - CHECK(name == new_name); + wxString name2 = mmDBWrapper::getPayee(pDb, payee_id, cat, subc2); + CHECK(name2 == new_name); CHECK(subc2 == -1); // restore - ok = mmDBWrapper::updatePayee(&db, g_PayeeName, id, cat, subc); + ok = mmDBWrapper::updatePayee(pDb, g_PayeeName, payee_id, cat, subcat); CHECK(ok); } //---------------------------------------------------------------------------- TEST(getAmountForPayee) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = 0; int cat = 0; int subc = 0; - bool ok = mmDBWrapper::getPayeeID(&db, g_PayeeName, id, cat, subc); - CHECK(ok); + int id = pCore->getPayeeID(g_PayeeName); + CHECK(id > 0); + wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); + CHECK(name = g_PayeeName); + // -- const wxDateTime dt = wxDateTime::Now(); -// double amt = mmDBWrapper::getAmountForPayee(&db, id, true, dt, dt); -// CHECK(amt == 0.0); + double amt = pCore->getAmountForPayee(id, true, dt, dt); + CHECK(amt == 0.0); } //---------------------------------------------------------------------------- + TEST(deletePayeeWithConstraints) { - wxSQLite3Database &db = getDb(); + wxSQLite3Database* pDb = get_pDb().get(); + mmCoreDB* pCore = pDb_core().get(); - int id = 0; int cat = 0; int subc = 0; - bool ok = mmDBWrapper::getPayeeID(&db, g_PayeeName, id, cat, subc); - CHECK(ok); + int id = pCore->getPayeeID(g_PayeeName); + CHECK(id > 0); + wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); + CHECK(name = g_PayeeName); + // -- - ok = mmDBWrapper::deletePayeeWithConstraints(&db, id); + bool ok = mmDBWrapper::deletePayeeWithConstraints(pDb, id); CHECK(ok); // -- - ok = mmDBWrapper::deletePayeeWithConstraints(&db, 0); + ok = mmDBWrapper::deletePayeeWithConstraints(pDb, 0); CHECK(ok); // returns true even for wrong id } //---------------------------------------------------------------------------- @@ -696,13 +721,13 @@ TEST(getNumAccounts) { - wxSQLite3Database &db = getDb(); + mmCoreDB* pCore = pDb_core().get(); - int cnt = mmDBWrapper::getNumAccounts(&db); + int cnt = pCore->getNumAccounts(); CHECK(!cnt); } //---------------------------------------------------------------------------- -#endif + } // SUITE //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-07-16 01:52:02
|
Revision: 2777 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2777&view=rev Author: stef145g Date: 2012-07-16 01:51:55 +0000 (Mon, 16 Jul 2012) Log Message: ----------- Branch 0.9.9.0: Update tests. Now all current tests complete successfully. Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-15 20:26:03 UTC (rev 2776) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-16 01:51:55 UTC (rev 2777) @@ -34,28 +34,30 @@ const wxString g_BudgetYear = wxT("2009"); const wxString g_CategName = wxT("new category"); const wxString g_SubCategName= wxT("new subcategory"); -const wxString g_CurrencyName = wxT("US DOLLAR"); +const wxString g_CurrencyName = wxT("US Dollar"); const wxString g_PayeeName = wxT("Payee #1"); //---------------------------------------------------------------------------- -/* - These tests create a new database which is used for the tests. - This class Structure is used to remove the temporary database. -*/ -struct Cleanup -{ - ~Cleanup(); -}; -//---------------------------------------------------------------------------- - +/***************************************************************************** + The test platform create a new database for the tests. +*****************************************************************************/ +// Returns the user's temporary storage area for the new database. wxString getDbPath() { wxFileName fn(wxFileName::GetTempDir(), wxT("mmex_tests.db3")); return fn.GetFullPath(); } -//---------------------------------------------------------------------------- -// Destructor of the Structure +/***************************************************************************** + This class is used to remove the temporary database. +*****************************************************************************/ +class Cleanup +{ +public: + ~Cleanup(); +}; + +// Cleanup class destructor - Called on test completion. Cleanup::~Cleanup() { try { @@ -66,6 +68,8 @@ } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +// Single point access for the database, and remove database on completion. boost::shared_ptr<wxSQLite3Database> get_pDb() { static Cleanup temp_database; @@ -83,7 +87,7 @@ return pDb; } //---------------------------------------------------------------------------- - +// Single point access for the database, stored in memory. boost::shared_ptr<mmCoreDB> pDb_core() { static boost::shared_ptr<mmCoreDB> pCore(new mmCoreDB(get_pDb())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-07-21 08:38:54
|
Revision: 2796 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2796&view=rev Author: stef145g Date: 2012-07-21 08:38:46 +0000 (Sat, 21 Jul 2012) Log Message: ----------- Two tests added to check transaction list functionality. One test fails. Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-21 01:29:48 UTC (rev 2795) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-21 08:38:46 UTC (rev 2796) @@ -110,28 +110,28 @@ TEST(HasBackupSupport) { - bool ok = wxSQLite3Database::HasBackupSupport(); + bool ok = get_pDb().get()->HasBackupSupport(); CHECK(ok); } //---------------------------------------------------------------------------- TEST(HasEncryptionSupport) { - bool ok = wxSQLite3Database::HasEncryptionSupport(); + bool ok = get_pDb().get()->HasEncryptionSupport(); CHECK(ok); } //---------------------------------------------------------------------------- TEST(HasMetaDataSupport) { - bool ok = wxSQLite3Database::HasMetaDataSupport(); + bool ok = get_pDb().get()->HasMetaDataSupport(); CHECK(ok); } //---------------------------------------------------------------------------- TEST(HasSavepointSupport) { - bool ok = wxSQLite3Database::HasSavepointSupport(); + bool ok = get_pDb().get()->HasSavepointSupport(); CHECK(ok); } //---------------------------------------------------------------------------- @@ -151,7 +151,7 @@ ok = mmDBWrapper::ViewExists(pDb, "master_view"); CHECK(ok); - pDb->ExecuteUpdate("drop view master_view"); +// pDb->ExecuteUpdate("drop view master_view"); } //---------------------------------------------------------------------------- @@ -735,6 +735,104 @@ } //---------------------------------------------------------------------------- +TEST(Add_new_transactions) +{ + mmCoreDB* pCore = pDb_core().get(); + + int trans_list_size = pCore->bTransactionList_.transactions_.size(); + CHECK(trans_list_size == 0); + + int account_id = 1; + + // 1st transaction + boost::shared_ptr<mmBankTransaction> pBankTransaction_1(new mmBankTransaction(pCore->db_)); + pBankTransaction_1->date_ = wxDateTime::Now(); + pBankTransaction_1->accountID_ = account_id; + pBankTransaction_1->amt_ = 100; + pBankTransaction_1->toAmt_ = 100; + int trans_id_1 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_1); + CHECK(trans_id_1 == 1); + + // 2nd transaction + boost::shared_ptr<mmBankTransaction> pBankTransaction_2(new mmBankTransaction(pCore->db_)); + pBankTransaction_2->date_ = wxDateTime::Now(); + pBankTransaction_2->accountID_ = account_id; + pBankTransaction_2->amt_ = 200; + pBankTransaction_2->toAmt_ = 200; + int trans_id_2 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_2); + CHECK(trans_id_2 == 2); + + // Checks that the transaction is in the database. + bool trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_2); + CHECK(trans_exist); + + double balance = pCore->bTransactionList_.getBalance(account_id); + CHECK(balance = 300); + + trans_list_size = pCore->bTransactionList_.transactions_.size(); + CHECK(trans_list_size == 2); + + bool trans_deleted_ok = pCore->bTransactionList_.deleteTransaction(account_id, trans_id_2); + CHECK(trans_deleted_ok); + + // checks that the transaction is not in the database. + trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_2); + CHECK(!trans_exist); + + // This method only deletes the transactions from memory ?? + pCore->bTransactionList_.deleteTransactions(account_id); + + balance = pCore->bTransactionList_.getBalance(account_id); + CHECK(balance == 0); + // Check that no transactions are left im memory + trans_list_size = pCore->bTransactionList_.transactions_.size(); + CHECK(trans_list_size == 0); + + // Check that the transaction is not in the database. + trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_1); + CHECK(!trans_exist); // + + //remove empty spaces from the database + pCore->db_.get()->Vacuum(); +} + +TEST(Copy_Paste_transactions) +{ + mmCoreDB* pCore = pDb_core().get(); + + int account_id = 1; + + boost::shared_ptr<mmBankTransaction> pBankTransaction_1(new mmBankTransaction(pCore->db_)); + pBankTransaction_1->date_ = wxDateTime::Now(); + pBankTransaction_1->accountID_ = account_id; + pBankTransaction_1->amt_ = 100; + pBankTransaction_1->toAmt_ = 100; + int trans_id_1 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_1); + CHECK(trans_id_1 == 2); // The transaction in previous test was not deleted from the database. + + bool new_trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_1); + CHECK(new_trans_exist); + + boost::shared_ptr<mmBankTransaction> pCopiedTrans = pCore->bTransactionList_.copyTransaction(pCore, trans_id_1, true); + int trans_id_2 = pCopiedTrans->transactionID(); + CHECK(trans_id_2 == 3); + + bool copied_trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pCopiedTrans); + CHECK(copied_trans_exist); + + pCopiedTrans->amt_ = 200; + pCopiedTrans->toAmt_ = 200; + pCore->bTransactionList_.updateTransaction(pCopiedTrans); + + double balance = pCore->bTransactionList_.getBalance(account_id); + CHECK(balance = 400); // 100 from undeleted trans, 100 new, 200 updated_copy = 400 + + int trans_list_size = pCore->bTransactionList_.transactions_.size(); + CHECK(trans_list_size == 2); + + // database is left with 3 transactions but memory only has 2. +} + } // SUITE //---------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-07-25 11:58:30
|
Revision: 2818 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2818&view=rev Author: vomikan Date: 2012-07-25 11:58:24 +0000 (Wed, 25 Jul 2012) Log Message: ----------- fix for USD id Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-25 11:13:07 UTC (rev 2817) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-25 11:58:24 UTC (rev 2818) @@ -171,7 +171,7 @@ wxString s = mmDBWrapper::getCurrencySymbol(pDb, 1); CHECK(s == L"EUR"); - s = mmDBWrapper::getCurrencySymbol(pDb, 7); + s = mmDBWrapper::getCurrencySymbol(pDb, 8); CHECK(s == L"USD"); s = mmDBWrapper::getCurrencySymbol(pDb, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-07-29 06:21:08
|
Revision: 2836 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2836&view=rev Author: stef145g Date: 2012-07-29 06:21:01 +0000 (Sun, 29 Jul 2012) Log Message: ----------- Tests corrected/updated Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-29 06:14:24 UTC (rev 2835) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-29 06:21:01 UTC (rev 2836) @@ -31,12 +31,16 @@ #include "mmcoredb.h" //---------------------------------------------------------------------------- -const wxString g_BudgetYear = wxT("2009"); -const wxString g_CategName = wxT("new category"); -const wxString g_SubCategName = wxT("new subcategory"); -const wxString g_CurrencyName = wxT("US Dollar"); -const wxString g_PayeeName = wxT("Payee #1"); -const wxString g_TransactionType = wxT("Deposit"); +const wxString g_BudgetYear = wxT("2009"); +const wxString g_CategName = wxT("new category"); +const wxString g_SubCategName = wxT("new subcategory"); +const wxString g_CurrencyName = wxT("US Dollar"); +const wxString g_PayeeName = wxT("Payee #1"); + +const wxString g_TransType_deposit = wxT("Deposit"); +const wxString g_TransType_withdrawal = wxT("Withdrawal"); +const wxString g_status_reconciled = wxT("R"); +const wxString g_status_void = wxT("V"); //---------------------------------------------------------------------------- /***************************************************************************** @@ -63,12 +67,27 @@ { try { wxRemoveFile(getDbPath()); + printf("\n"); } catch (...) { wxASSERT(false); } } //---------------------------------------------------------------------------- +void displayTimeTaken(wxString msg, wxDateTime start_time) +{ + wxDateTime end_time(wxDateTime::Now()); + wxLongLong time_dif = end_time.GetMillisecond() - start_time.GetMillisecond(); + + wxString display_message; + display_message << wxT("Time Taken: ") + << time_dif + << wxT(" milliseconds - Test: ") + << msg + << wxT("\n"); + printf(display_message.char_str()); +} + //---------------------------------------------------------------------------- // Single point access for the database, and remove database on completion. boost::shared_ptr<wxSQLite3Database> get_pDb() @@ -169,10 +188,11 @@ { mmCoreDB* pCore = pDb_core().get(); - wxString s = mmDBWrapper::getCurrencySymbol(pCore->db_.get(), 1); + int currency_id = 1; + wxString s = mmDBWrapper::getCurrencySymbol(pCore->db_.get(), currency_id); CHECK(s == L"EUR"); - int currency_id = pCore->currencyList_.getCurrencyID(g_CurrencyName); + currency_id = pCore->currencyList_.getCurrencyID(g_CurrencyName); s = mmDBWrapper::getCurrencySymbol(pCore->db_.get(), currency_id); CHECK(s == L"USD"); @@ -611,7 +631,7 @@ CHECK(id > 0); wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); - CHECK(name = g_PayeeName); + CHECK(name == g_PayeeName); CHECK(cat > 0); CHECK(subc > 0); @@ -690,7 +710,7 @@ CHECK(id > 0); wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); - CHECK(name = g_PayeeName); + CHECK(name == g_PayeeName); // -- @@ -712,7 +732,7 @@ CHECK(id > 0); wxString name = mmDBWrapper::getPayee(pDb, id, cat, subc); - CHECK(name = g_PayeeName); + CHECK(name == g_PayeeName); // -- @@ -736,8 +756,9 @@ } //---------------------------------------------------------------------------- -TEST(Add_new_transactions) +TEST(add_new_transactions) { + wxDateTime start_time(wxDateTime::Now()); mmCoreDB* pCore = pDb_core().get(); int trans_list_size = pCore->bTransactionList_.transactions_.size(); @@ -745,62 +766,87 @@ int account_id = 1; - // 1st transaction + // Add a deposit transaction Previous month boost::shared_ptr<mmBankTransaction> pBankTransaction_1(new mmBankTransaction(pCore->db_)); - pBankTransaction_1->date_ = wxDateTime::Now(); + pBankTransaction_1->date_ = wxDateTime::Now().Subtract(wxDateSpan::Days(32)); pBankTransaction_1->accountID_ = account_id; - pBankTransaction_1->amt_ = 100; - pBankTransaction_1->toAmt_ = 100; - pBankTransaction_1->transType_ = wxT("Deposit"); + pBankTransaction_1->amt_ = 500; + pBankTransaction_1->toAmt_ = 500; + pBankTransaction_1->status_ = g_status_reconciled; + pBankTransaction_1->transType_ = g_TransType_deposit; int trans_id_1 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_1); CHECK(trans_id_1 == 1); - // 2nd transaction + // Add a withdrawal transaction - Today boost::shared_ptr<mmBankTransaction> pBankTransaction_2(new mmBankTransaction(pCore->db_)); pBankTransaction_2->date_ = wxDateTime::Now(); pBankTransaction_2->accountID_ = account_id; pBankTransaction_2->amt_ = 200; pBankTransaction_2->toAmt_ = 200; - pBankTransaction_1->transType_ = g_TransactionType; + pBankTransaction_2->status_ = g_status_reconciled; + pBankTransaction_2->transType_ = g_TransType_withdrawal; int trans_id_2 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_2); CHECK(trans_id_2 == 2); + // Add a void deposit transaction - 2 days before today; + boost::shared_ptr<mmBankTransaction> pBankTransaction_3(new mmBankTransaction(pCore->db_)); + pBankTransaction_3->date_ = wxDateTime::Now().Subtract(wxDateSpan::Days(2)); + pBankTransaction_3->accountID_ = account_id; + pBankTransaction_3->amt_ = 1200; + pBankTransaction_3->toAmt_ = 1200; + pBankTransaction_3->status_ = g_status_void; + pBankTransaction_3->transType_ = g_TransType_deposit; + int trans_id_3 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_3); + CHECK(trans_id_3 == 3); + // Checks that the transaction is in the database. bool trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_2); CHECK(trans_exist); double balance = pCore->bTransactionList_.getBalance(account_id); - CHECK(balance = 300); + CHECK(balance == 300); trans_list_size = pCore->bTransactionList_.transactions_.size(); - CHECK(trans_list_size == 2); + CHECK(trans_list_size == 3); - bool trans_deleted_ok = pCore->bTransactionList_.deleteTransaction(account_id, trans_id_2); + // Delete the void transaction + bool trans_deleted_ok = pCore->bTransactionList_.deleteTransaction(account_id, trans_id_3); CHECK(trans_deleted_ok); // checks that the transaction is not in the database. - trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_2); + trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_3); CHECK(!trans_exist); - // This method only deletes the transactions from memory ?? - pCore->bTransactionList_.deleteTransactions(account_id); + // This method deletes the transactions from memory but not the database + // Database transactions need to be deleted individually + // pCore->bTransactionList_.deleteTransactions(account_id); + pCore->bTransactionList_.deleteTransaction(account_id, trans_id_1); + pCore->bTransactionList_.deleteTransaction(account_id, trans_id_2); + balance = pCore->bTransactionList_.getBalance(account_id); CHECK(balance == 0); + // Check that no transactions are left im memory trans_list_size = pCore->bTransactionList_.transactions_.size(); CHECK(trans_list_size == 0); - // Check that the transaction is not in the database. + // Check that the transactions are not in the database. trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_1); CHECK(!trans_exist); // + trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_2); + CHECK(!trans_exist); // - // remove empty spaces from the database - // pCore->db_.get()->Vacuum(); + displayTimeTaken(wxT("add_new_transactions"), start_time); + + //remove empty spaces from the database + pCore->db_.get()->Vacuum(); + displayTimeTaken(wxT("add_new_transactions - Vacuum done"), start_time); } -TEST(Copy_Paste_transactions) +TEST(copy_paste_transactions) { + wxDateTime start_time(wxDateTime::Now()); mmCoreDB* pCore = pDb_core().get(); int account_id = 1; @@ -810,16 +856,17 @@ pBankTransaction_1->accountID_ = account_id; pBankTransaction_1->amt_ = 100; pBankTransaction_1->toAmt_ = 100; - pBankTransaction_1->transType_ = g_TransactionType; + pBankTransaction_1->status_ = g_status_reconciled; + pBankTransaction_1->transType_ = g_TransType_withdrawal; int trans_id_1 = pCore->bTransactionList_.addTransaction(pCore, pBankTransaction_1); - CHECK(trans_id_1 == 2); // The transaction in previous test was not deleted from the database. + CHECK(trans_id_1 == 1); // The transaction in previous test was not deleted from the database. bool new_trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pBankTransaction_1); CHECK(new_trans_exist); boost::shared_ptr<mmBankTransaction> pCopiedTrans = pCore->bTransactionList_.copyTransaction(pCore, trans_id_1, account_id, true); int trans_id_2 = pCopiedTrans->transactionID(); - CHECK(trans_id_2 == 3); + CHECK(trans_id_2 == 2); bool copied_trans_exist = pCore->bTransactionList_.checkForExistingTransaction(pCopiedTrans); CHECK(copied_trans_exist); @@ -829,12 +876,11 @@ pCore->bTransactionList_.updateTransaction(pCopiedTrans); double balance = pCore->bTransactionList_.getBalance(account_id); - CHECK(balance = 400); // 100 from undeleted trans, 100 new, 200 updated_copy = 400 + CHECK(balance == -300); int trans_list_size = pCore->bTransactionList_.transactions_.size(); CHECK(trans_list_size == 2); - - // database is left with 3 transactions but memory only has 2. + displayTimeTaken(wxT("copy_paste_transactions"), start_time); } } // SUITE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-07-31 07:50:04
|
Revision: 2844 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2844&view=rev Author: vomikan Date: 2012-07-31 07:49:56 +0000 (Tue, 31 Jul 2012) Log Message: ----------- timing fix Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-30 12:34:20 UTC (rev 2843) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-07-31 07:49:56 UTC (rev 2844) @@ -74,18 +74,15 @@ } //---------------------------------------------------------------------------- -void displayTimeTaken(wxString msg, wxDateTime start_time) +void const displayTimeTaken(const wxString msg, const wxDateTime start_time) { - wxDateTime end_time(wxDateTime::Now()); - wxLongLong time_dif = end_time.GetMillisecond() - start_time.GetMillisecond(); + const wxDateTime end_time(wxDateTime::UNow()); + const wxString time_dif = (end_time - start_time).Format(wxT("%S%l")); + //(1000*end_time.GetSecond() + end_time.GetMillisecond()) - + //(1000*start_time.GetSecond() + start_time.GetMillisecond()); - wxString display_message; - display_message << wxT("Time Taken: ") - << time_dif - << wxT(" milliseconds - Test: ") - << msg - << wxT("\n"); - printf(display_message.char_str()); + + printf(wxString::Format(wxT("Time Taken: %s milliseconds - Test: %s \n"), time_dif.c_str(), msg.c_str()).char_str()); } //---------------------------------------------------------------------------- @@ -123,7 +120,9 @@ TEST(wxSQLite3Exception) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* db = get_pDb().get(); + displayTimeTaken(wxT("wxSQLite3Exception"), start_time); CHECK_THROW(db->ExecuteUpdate("update bad_table set bad_col = unknown_value"), wxSQLite3Exception); } //---------------------------------------------------------------------------- @@ -158,6 +157,7 @@ TEST(ViewExists) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); bool ok = mmDBWrapper::ViewExists(pDb, "I'm_not_exists"); @@ -170,6 +170,7 @@ ok = mmDBWrapper::ViewExists(pDb, "master_view"); CHECK(ok); + displayTimeTaken(wxT("ViewExists"), start_time); // pDb->ExecuteUpdate("drop view master_view"); } @@ -186,6 +187,7 @@ TEST(getCurrencySymbol) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int currency_id = 1; @@ -198,19 +200,23 @@ s = mmDBWrapper::getCurrencySymbol(pCore->db_.get(), 0); CHECK(s.empty()); + displayTimeTaken(wxT("getCurrencySymbol"), start_time); } //---------------------------------------------------------------------------- TEST(checkDBVersion) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); bool ok = mmDBWrapper::checkDBVersion(pDb); CHECK(ok); + displayTimeTaken(wxT("checkDBVersion"), start_time); } //---------------------------------------------------------------------------- TEST(addBudgetYear) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -220,11 +226,13 @@ year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); + displayTimeTaken(wxT("addBudgetYear"), start_time); } //---------------------------------------------------------------------------- TEST(getBudgetYearID) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, wxT("unknown_year")); @@ -232,11 +240,13 @@ year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); CHECK(year_id > 0); + displayTimeTaken(wxT("getBudgetYearID"), start_time); } //---------------------------------------------------------------------------- TEST(getBudgetYearForID) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -244,11 +254,13 @@ wxString year = mmDBWrapper::getBudgetYearForID(pDb, year_id); CHECK(year == g_BudgetYear); + displayTimeTaken(wxT("getBudgetYearForID"), start_time); } //---------------------------------------------------------------------------- TEST(updateYearForID) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); int year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -265,11 +277,13 @@ mmDBWrapper::updateYearForID(pDb, g_BudgetYear, year_id); year = mmDBWrapper::getBudgetYearForID(pDb, year_id); CHECK(year == g_BudgetYear); + displayTimeTaken(wxT("updateYearForID"), start_time); } //---------------------------------------------------------------------------- TEST(copyBudgetYear) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); int base_year_id = mmDBWrapper::getBudgetYearID(pDb, g_BudgetYear); @@ -292,11 +306,13 @@ ok = mmDBWrapper::copyBudgetYear(pDb, new_year_id, base_year_id); CHECK(ok); + displayTimeTaken(wxT("copyBudgetYear"), start_time); } //---------------------------------------------------------------------------- TEST(deleteBudgetYear) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); bool deleted = mmDBWrapper::deleteBudgetYear(pDb, wxT("wrong_year")); @@ -304,13 +320,13 @@ deleted = mmDBWrapper::deleteBudgetYear(pDb, g_BudgetYear); CHECK(deleted); + displayTimeTaken(wxT("deleteBudgetYear"), start_time); } //---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - TEST(addCategory) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.addCategory(g_CategName); @@ -318,11 +334,13 @@ int id = pCore->categoryList_.getID(g_CategName); CHECK(id == cat_id); + displayTimeTaken(wxT("addCategory"), start_time); } //---------------------------------------------------------------------------- TEST(addSubCategory) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.getID(g_CategName); @@ -332,11 +350,13 @@ int id = pCore->categoryList_.getSubCategoryID(cat_id, g_SubCategName); CHECK(id == subcat_id); + displayTimeTaken(wxT("addSubCategory"), start_time); } //---------------------------------------------------------------------------- TEST(getCategoryID) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.getID(g_CategName); @@ -344,11 +364,13 @@ cat_id = pCore->categoryList_.getID(wxT("unknown category")); CHECK(cat_id == -1); + displayTimeTaken(wxT("getCategoryID"), start_time); } //---------------------------------------------------------------------------- TEST(getSubCategoryID) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.getID(g_CategName); @@ -359,11 +381,13 @@ sc_id = pCore->categoryList_.getSubCategoryID(cat_id, wxT("unknown subcategory")); CHECK(sc_id == -1); + displayTimeTaken(wxT("getSubCategoryID"), start_time); } //---------------------------------------------------------------------------- TEST(getCategoryName) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.getID(g_CategName); @@ -374,11 +398,13 @@ name = pCore->categoryList_.getCategoryName(0); CHECK(name.empty()); + displayTimeTaken(wxT("getCategoryName"), start_time); } //---------------------------------------------------------------------------- TEST(getSubCategoryName) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -393,10 +419,12 @@ name = mmDBWrapper::getSubCategoryName(pDb, cat_id, 0); CHECK(name.empty()); + displayTimeTaken(wxT("getSubCategoryName"), start_time); } //---------------------------------------------------------------------------- TEST(updateCategory) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cat_id = pCore->categoryList_.getID(g_CategName); @@ -428,11 +456,13 @@ ok = pCore->categoryList_.updateCategory(cat_id, sc_id, g_SubCategName); // restore CHECK(ok); + displayTimeTaken(wxT("updateCategory"), start_time); } //---------------------------------------------------------------------------- TEST(deleteSubCategoryWithConstraints) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -444,11 +474,13 @@ bool ok = mmDBWrapper::deleteSubCategoryWithConstraints(pDb, cat_id, sc_id); CHECK(ok); + displayTimeTaken(wxT("deleteSubCategoryWithConstraints"), start_time); } //---------------------------------------------------------------------------- TEST(deleteCategoryWithConstraints) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -457,12 +489,13 @@ bool ok = mmDBWrapper::deleteCategoryWithConstraints(pDb, cat_id); CHECK(ok); + displayTimeTaken(wxT("deleteCategoryWithConstraints"), start_time); } //---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- TEST(getCurrencyID) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -470,11 +503,13 @@ id = pCore->currencyList_.getCurrencyID(wxT("unknown currency")); CHECK(id == -1); + displayTimeTaken(wxT("getCurrencyID"), start_time); } //---------------------------------------------------------------------------- TEST(getCurrencyName) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int id = pCore->currencyList_.getCurrencyID(g_CurrencyName); @@ -487,11 +522,13 @@ name = pCore->currencyList_.getCurrencyName(-1); CHECK(name.empty()); + displayTimeTaken(wxT("getCurrencyName"), start_time); } //---------------------------------------------------------------------------- TEST(setBaseCurrencySettings) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -502,11 +539,13 @@ int base_id = mmDBWrapper::getBaseCurrencySettings(pDb); CHECK(base_id == id); + displayTimeTaken(wxT("setBaseCurrencySettings"), start_time); } //---------------------------------------------------------------------------- TEST(getBaseCurrencySettings) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -515,20 +554,24 @@ int base_id = mmDBWrapper::getBaseCurrencySettings(pDb); CHECK(base_id == id); + displayTimeTaken(wxT("getBaseCurrencySettings"), start_time); } //---------------------------------------------------------------------------- TEST(loadBaseCurrencySettings) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmDBWrapper::loadBaseCurrencySettings(pDb); CHECK(true); + displayTimeTaken(wxT("loadBaseCurrencySettings"), start_time); } //---------------------------------------------------------------------------- TEST(getCurrencyBaseConvRate) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -537,11 +580,13 @@ double rate = mmDBWrapper::getCurrencyBaseConvRateForId(pDb, id); CHECK(rate != 0.0); + displayTimeTaken(wxT("getCurrencyBaseConvRate"), start_time); } //---------------------------------------------------------------------------- TEST(loadSettings) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -549,12 +594,13 @@ CHECK(id > 0); mmDBWrapper::loadSettings(pDb, id); + displayTimeTaken(wxT("loadSettings"), start_time); } //---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- TEST(setInfoSettingValue) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); const wxString name = wxT("settings name"); @@ -564,11 +610,13 @@ wxString s = mmDBWrapper::getInfoSettingValue(pDb, name, wxT("")); CHECK(s == val); + displayTimeTaken(wxT("setInfoSettingValue"), start_time); } //---------------------------------------------------------------------------- TEST(getInfoSettingValue) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); const wxString name = wxT("wrong name"); @@ -582,12 +630,13 @@ mmDBWrapper::setInfoSettingValue(pDb, name, defVal); s = mmDBWrapper::getInfoSettingValue(pDb, name, wxT("")); CHECK(s == defVal); + displayTimeTaken(wxT("getInfoSettingValue"), start_time); } -//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- TEST(addPayee) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -608,11 +657,13 @@ int payeeID = pCore->payeeList_.add(g_PayeeName); mmDBWrapper::updatePayee(pDb, g_PayeeName, payeeID, cat_id, sc_id); + displayTimeTaken(wxT("addPayee"), start_time); } //---------------------------------------------------------------------------- TEST(getPayeeID) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -639,11 +690,13 @@ id = pCore->payeeList_.getID(wxT("bad payee name")); CHECK(id < 1); + displayTimeTaken(wxT("getPayeeID"), start_time); } //---------------------------------------------------------------------------- TEST(getPayee) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -663,11 +716,13 @@ name = mmDBWrapper::getPayee(pDb, 0, cat, subcat); CHECK(name.empty()); + displayTimeTaken(wxT("getPayee"), start_time); } //---------------------------------------------------------------------------- TEST(updatePayee) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -695,11 +750,13 @@ ok = mmDBWrapper::updatePayee(pDb, g_PayeeName, payee_id, cat, subcat); CHECK(ok); + displayTimeTaken(wxT("updatePayee"), start_time); } //---------------------------------------------------------------------------- TEST(getAmountForPayee) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -717,11 +774,13 @@ const wxDateTime dt = wxDateTime::Now(); double amt = pCore->bTransactionList_.getAmountForPayee(id, true, dt, dt); CHECK(amt == 0.0); + displayTimeTaken(wxT("getAmountForPayee"), start_time); } //---------------------------------------------------------------------------- TEST(deletePayeeWithConstraints) { + const wxDateTime start_time(wxDateTime::UNow()); wxSQLite3Database* pDb = get_pDb().get(); mmCoreDB* pCore = pDb_core().get(); @@ -743,22 +802,24 @@ ok = mmDBWrapper::deletePayeeWithConstraints(pDb, 0); CHECK(ok); // returns true even for wrong id + displayTimeTaken(wxT("deletePayeeWithConstraints"), start_time); } //---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- TEST(getNumAccounts) { + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int cnt = pCore->accountList_.getNumAccounts(); CHECK(!cnt); + displayTimeTaken(wxT("getNumAccounts"), start_time); } //---------------------------------------------------------------------------- TEST(add_new_transactions) { - wxDateTime start_time(wxDateTime::Now()); + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int trans_list_size = pCore->bTransactionList_.transactions_.size(); @@ -840,13 +901,12 @@ displayTimeTaken(wxT("add_new_transactions"), start_time); //remove empty spaces from the database - pCore->db_.get()->Vacuum(); - displayTimeTaken(wxT("add_new_transactions - Vacuum done"), start_time); + //pCore->db_.get()->Vacuum(); } TEST(copy_paste_transactions) { - wxDateTime start_time(wxDateTime::Now()); + const wxDateTime start_time(wxDateTime::UNow()); mmCoreDB* pCore = pDb_core().get(); int account_id = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vo...@us...> - 2012-08-18 04:35:05
|
Revision: 2897 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2897&view=rev Author: vomikan Date: 2012-08-18 04:34:59 +0000 (Sat, 18 Aug 2012) Log Message: ----------- update Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-08-18 04:29:59 UTC (rev 2896) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-08-18 04:34:59 UTC (rev 2897) @@ -772,7 +772,7 @@ // -- const wxDateTime dt = wxDateTime::Now(); - double amt = pCore->bTransactionList_.getAmountForPayee(id, true, dt, dt); + double amt = pCore->bTransactionList_.getAmountForPayee(pCore, id, true, dt, dt); CHECK(amt == 0.0); displayTimeTaken(wxT("getAmountForPayee"), start_time); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-08-18 14:26:11
|
Revision: 2901 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=2901&view=rev Author: stef145g Date: 2012-08-18 14:26:05 +0000 (Sat, 18 Aug 2012) Log Message: ----------- Update Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-08-18 14:23:24 UTC (rev 2900) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-08-18 14:26:05 UTC (rev 2901) @@ -660,7 +660,7 @@ boost::shared_ptr<mmPayee> pPayee = pCore->payeeList_.GetPayeeSharedPtr(payeeID); pPayee->categoryId_ = cat_id; pPayee->subcategoryId_ = sc_id; - bool OK = pPayee->Update(pDb); + bool OK = pPayee->UpdateDb(pDb); CHECK(OK); displayTimeTaken(wxT("addPayee"), start_time); @@ -731,7 +731,7 @@ pPayee->name_ = new_name; pPayee->categoryId_ = 0; pPayee->subcategoryId_ = -1; - bool ok = pPayee->Update(pDb); + bool ok = pPayee->UpdateDb(pDb); CHECK(ok); // Reset the payee list to match the database @@ -749,7 +749,7 @@ pPayee->name_ = g_PayeeName; pPayee->categoryId_ = cat; pPayee->subcategoryId_ = subcat; - ok = pPayee->Update(pDb); + ok = pPayee->UpdateDb(pDb); CHECK(ok); displayTimeTaken(wxT("updatePayee"), start_time); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ste...@us...> - 2012-10-05 00:59:30
|
Revision: 3017 http://moneymanagerex.svn.sourceforge.net/moneymanagerex/?rev=3017&view=rev Author: stef145g Date: 2012-10-05 00:59:23 +0000 (Fri, 05 Oct 2012) Log Message: ----------- Update required for wx28 Release Modified Paths: -------------- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp Modified: branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp =================================================================== --- branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-10-04 17:00:21 UTC (rev 3016) +++ branches/0.9.9.0/mmex/src/tests/dbwrapper_test.cpp 2012-10-05 00:59:23 UTC (rev 3017) @@ -28,6 +28,7 @@ #include "utils.h" #include "mmcoredb.h" #include "mmex_settings.h" +#include <iostream> //---------------------------------------------------------------------------- const wxString g_BudgetYear = wxT("2009"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |