Unit test of compound interest calculation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.