[kmymoney] [Bug 385993] Error in investment interest (Jahresrendite)

Ralf Habacker bugzilla_noreply at kde.org
Wed Oct 31 22:45:10 GMT 2018


https://bugs.kde.org/show_bug.cgi?id=385993

--- Comment #4 from Ralf Habacker <ralf.habacker at freenet.de> ---
Class CashFlowList has a dumpAll() method, which shows 

"2005-09-22"   "-347257/100" 
"2009-03-18"   "151284/25" 
"1989-11-01"   "0/1" 
"2017-08-11"   "0/1" 

Adding this values to an additional QueryTableTest method as: 

void QueryTableTest::testCashFlowAnalysis2()
{
  CashFlowList list;

  list += CashFlowListItem(QDate(2005, 9, 22), MyMoneyMoney(-3472.57));
  list += CashFlowListItem(QDate(2009, 3, 18), MyMoneyMoney(6051.36));
  list += CashFlowListItem(QDate(1998, 11, 1), MyMoneyMoney(0.0));
  list += CashFlowListItem(QDate(2017, 8, 11), MyMoneyMoney(0.0));

  MyMoneyMoney IRR(list.IRR(), 1000);

  QCOMPARE(IRR.toDouble(), MyMoneyMoney(173, 1000).toDouble());
}

returns:

FAIL!  : QueryTableTest::testCashFlowAnalysis2() Compared doubles are not the
same (fuzzy compare)
   Actual (IRR.toDouble()): -0.928
   Expected (MyMoneyMoney(173, 1000).toDouble()): 0.173
   Loc: [/home/ralf/src/kmymoney-4.8/kmymoney/reports/querytabletest.cpp(365)]

Removing the ling 

  list += CashFlowListItem(QDate(2017, 8, 11), MyMoneyMoney(0.0));

let the test be successful.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the KMyMoney-devel mailing list