Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/mymoney/tests/mymoneyforecast-test.cpp
Context not available. | |||||
52 | this->moT3 = MyMoneyMoney(84, 1); | 52 | this->moT3 = MyMoneyMoney(84, 1); | ||
---|---|---|---|---|---|
53 | this->moT4 = MyMoneyMoney(62, 1); | 53 | this->moT4 = MyMoneyMoney(62, 1); | ||
54 | this->moT5 = MyMoneyMoney(104, 1); | 54 | this->moT5 = MyMoneyMoney(104, 1); | ||
55 | } catch (const MyMoneyException & e) { | 55 | } catch (const std::exception &e) { | ||
56 | qDebug() << e.what(); | 56 | qDebug() << e.what(); | ||
57 | } | 57 | } | ||
58 | } | 58 | } | ||
Context not available. | |||||
141 | KMyMoneySettings::setForecastDays(-10); | 141 | KMyMoneySettings::setForecastDays(-10); | ||
142 | a.doForecast(); | 142 | a.doForecast(); | ||
143 | } | 143 | } | ||
144 | catch (const MyMoneyException &e) | 144 | catch (const std::exception &e) | ||
145 | { | 145 | { | ||
146 | QFAIL("Unexpected exception"); | 146 | QFAIL("Unexpected exception"); | ||
147 | } | 147 | } | ||
Context not available. | |||||
149 | KMyMoneySettings::setForecastAccountCycle(-20); | 149 | KMyMoneySettings::setForecastAccountCycle(-20); | ||
150 | a.doForecast(); | 150 | a.doForecast(); | ||
151 | } | 151 | } | ||
152 | catch (const MyMoneyException &e) { | 152 | catch (const std::exception &e) { | ||
153 | QFAIL("Unexpected exception"); | 153 | QFAIL("Unexpected exception"); | ||
154 | } | 154 | } | ||
155 | try { | 155 | try { | ||
156 | KMyMoneySettings::setForecastCycles(-10); | 156 | KMyMoneySettings::setForecastCycles(-10); | ||
157 | a.doForecast(); | 157 | a.doForecast(); | ||
158 | } | 158 | } | ||
159 | catch (const MyMoneyException &e) { | 159 | catch (const std::exception &e) { | ||
160 | QFAIL("Unexpected exception"); | 160 | QFAIL("Unexpected exception"); | ||
161 | } | 161 | } | ||
162 | 162 | | |||
Context not available. | |||||
164 | KMyMoneySettings::setForecastAccountCycle(0); | 164 | KMyMoneySettings::setForecastAccountCycle(0); | ||
165 | a.doForecast(); | 165 | a.doForecast(); | ||
166 | } | 166 | } | ||
167 | catch (const MyMoneyException &e) { | 167 | catch (const std::exception &e) { | ||
168 | QFAIL("Unexpected exception"); | 168 | QFAIL("Unexpected exception"); | ||
169 | } | 169 | } | ||
170 | try { | 170 | try { | ||
Context not available. | |||||
173 | KMyMoneySettings::setForecastAccountCycle(0); | 173 | KMyMoneySettings::setForecastAccountCycle(0); | ||
174 | a.doForecast(); | 174 | a.doForecast(); | ||
175 | } | 175 | } | ||
176 | catch (const MyMoneyException &e) { | 176 | catch (const std::exception &e) { | ||
177 | QVERIFY("Unexpected exception"); | 177 | QVERIFY("Unexpected exception"); | ||
178 | }*/ | 178 | }*/ | ||
179 | } | 179 | } | ||
Context not available. | |||||
286 | 286 | | |||
287 | try { | 287 | try { | ||
288 | MyMoneyForecast::calculateAccountTrend(a_checking, 0); | 288 | MyMoneyForecast::calculateAccountTrend(a_checking, 0); | ||
289 | } catch (const MyMoneyException &e) { | 289 | } catch (const std::exception &e) { | ||
290 | QVERIFY(e.what().compare("Illegal arguments when calling calculateAccountTrend. trendDays must be higher than 0") == 0); | 290 | QVERIFY(QString::fromLatin1(e.what()).startsWith("Illegal arguments when calling calculateAccountTrend. trendDays must be higher than 0")); | ||
291 | } | 291 | } | ||
292 | try { | 292 | try { | ||
293 | MyMoneyForecast::calculateAccountTrend(a_checking, -10); | 293 | MyMoneyForecast::calculateAccountTrend(a_checking, -10); | ||
294 | } catch (const MyMoneyException &e) { | 294 | } catch (const std::exception &e) { | ||
295 | QVERIFY(e.what().compare("Illegal arguments when calling calculateAccountTrend. trendDays must be higher than 0") == 0); | 295 | QVERIFY(QString::fromLatin1(e.what()).startsWith("Illegal arguments when calling calculateAccountTrend. trendDays must be higher than 0")); | ||
296 | } | 296 | } | ||
297 | 297 | | |||
298 | //test that it calculates correctly | 298 | //test that it calculates correctly | ||
Context not available. | |||||
615 | try { | 615 | try { | ||
616 | auto days = a.daysToZeroBalance(nullAcc); | 616 | auto days = a.daysToZeroBalance(nullAcc); | ||
617 | Q_UNUSED(days) | 617 | Q_UNUSED(days) | ||
618 | } catch (const MyMoneyException &) { | 618 | } catch (const std::exception &) { | ||
619 | QFAIL("Unexpected exception"); | 619 | QFAIL("Unexpected exception"); | ||
620 | } | 620 | } | ||
621 | 621 | | |||
Context not available. |