Bug 491914

Summary: mymoneyfinancialcalculator-test fails with mingw-builds
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 5.2
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 488491    
Attachments: compressed log file

Description Ralf Habacker 2024-08-19 18:15:23 UTC
STEPS TO REPRODUCE
1. see appended log

OBSERVED RESULT
Running mymoneyfinancialcalculator-test from a MinGW build fails
 
7/38 Test  #8: mymoneyfinancialcalculator-test .......***Failed    0.55 sec

Inspecting the test log  shows:

8: ********* Start testing of MyMoneyFinancialCalculatorTest *********
8: Config: Using QtTest library 5.15.14, Qt 5.15.14 (i386-little_endian-ilp32 shared (dynamic) release build; by GCC 13.2.0), windows 7sp1
8: PASS   : MyMoneyFinancialCalculatorTest::initTestCase()
8: PASS   : MyMoneyFinancialCalculatorTest::testEmptyConstructor()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetPrec()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetNpp()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetPF()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetCF()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetBep()
8: PASS   : MyMoneyFinancialCalculatorTest::testSetDisc()
8: FAIL!  : MyMoneyFinancialCalculatorTest::testSetIr() 'm->d_func()->m_ir == 12.3' returned FALSE. ()
8: /home/abuild/rpmbuild/BUILD/kmymoney-5.1.80+QT515+KF5103+20240819+git.9e9d8d588/kmymoney/mymoney/tests/mymoneyfinancialcalculator-test.cpp(91) : failure location
8: FAIL!  : MyMoneyFinancialCalculatorTest::testSetPv() 'm->d_func()->m_pv == 23.4' returned FALSE. ()
8: /home/abuild/rpmbuild/BUILD/kmymoney-5.1.80+QT515+KF5103+20240819+git.9e9d8d588/kmymoney/mymoney/tests/mymoneyfinancialcalculator-test.cpp(98) : failure location
8: PASS   : MyMoneyFinancialCalculatorTest::testSetPmt()
8: FAIL!  : MyMoneyFinancialCalculatorTest::testSetFv() 'm->d_func()->m_fv == 45.6' returned FALSE. ()
8: /home/abuild/rpmbuild/BUILD/kmymoney-5.1.80+QT515+KF5103+20240819+git.9e9d8d588/kmymoney/mymoney/tests/mymoneyfinancialcalculator-test.cpp(112) : failure location
8: PASS   : MyMoneyFinancialCalculatorTest::testCombinedSet()
8: PASS   : MyMoneyFinancialCalculatorTest::testNumPayments()
8: PASS   : MyMoneyFinancialCalculatorTest::testUseCase1()
8: PASS   : MyMoneyFinancialCalculatorTest::testUseCase2()
8: PASS   : MyMoneyFinancialCalculatorTest::cleanupTestCase()
8: Totals: 14 passed, 3 failed, 0 skipped, 0 blacklisted, 5ms
8: ********* Finished testing of MyMoneyFinancialCalculatorTest *********

EXPECTED RESULT
The test should not fail.

ADDITIONAL INFORMATION
> MyMoneyFinancialCalculatorTest::testSetIr() 'm->d_func()->m_ir == 12.3' 

Both numbers are of type double; the comparison of two values with the operator == may not work due to rounding problems. The use of QCOMPARE(m->d_func()->m_ir, 12.3), can solve this problem, as this type of problem is taken into account.
Comment 1 Ralf Habacker 2024-08-19 19:23:07 UTC
Created attachment 172755 [details]
compressed log file
Comment 2 Ralf Habacker 2024-08-20 10:22:04 UTC
A possibly relevant merge request was started @https://invent.kde.org/office/kmymoney/-/merge_requests/226
Comment 3 Ralf Habacker 2024-08-20 11:40:47 UTC
Git commit e73bd3872e565ca6af122cda212f5df684fab23f by Ralf Habacker.
Committed on 20/08/2024 at 10:19.
Pushed by tbaumgart into branch 'master'.

Fix 'mymoneyfinancialcalculator-test fails with mingw-builds'
FIXED-IN:5.2

M  +4    -4    kmymoney/mymoney/tests/mymoneyfinancialcalculator-test.cpp

https://invent.kde.org/office/kmymoney/-/commit/e73bd3872e565ca6af122cda212f5df684fab23f