Test module |
Test input |
Expected results |
Run results |
Calculate Principal |
(Final value F, age n, interest rate i) |
Principal P |
|
1 |
(3000000,0.03,10) |
2232281 |
√ |
2 |
(230000,0.05,30) |
53216 |
√ |
Calculation life |
(final value F, principal p, interest rate i) |
Duration N |
|
1 |
(2000000, 1000000, 0.1) |
8 |
√ |
2 |
(20000,3000,0.1) |
20 |
√ |
Calculate annual interest rate |
(final value F, principal p, age n) |
Annual Interest Rate I |
|
1 |
(2000000,1000000,10) |
0.072 |
√ |
2 |
(300000,25000,10) |
0.282 |
√ |
Test scenario: Calculate principal, age, annual interest rate
Expected return value:
Principal: 2232281 actual value: 2232281.75 allowable Error: 1.0
Annual interest Rate: 0.072 actual value: 0,072 allowable error: 0.005
Test results:
Description: I don't know how to do it because I just touched the unit test. The input range for the storage life and the annual interest rate is not unit tested and is controlled only in the source program.
Source code Address: http://www.cnblogs.com/950525kxj/p/5339303.html
Test code: Https://github.com/kexiaojun/text/blob/master/kxj/src/kxj/FulijisuanTest.java
Unit test of compound interest calculation