Compound Interest Calculation 4.0 unit test

Source: Internet
Author: User

—————————— Compound Interest Calculation Program Unit test report ——————————

———————————— 4.0 Unit Test ——————————————

———————————————— Requirements ——————————————

JUnit unit tests are performed based on the compound interest calculation program.

What will happen in the test, and what are the results?

What is the expected return value?

Write the test program.

Run the test.

Complete the result:

Test one: compounding and principal interest

1. The expected return value is 13439, the actual value is 13439.16, allowing for an error within 1.0.

2. Test procedure:

This is compound interest calculation:

The test succeeds under the condition that the allowable error is 1.0. The results are as follows:

The test fails with an allowable error of 0.0, as shown in the test result:

Test two: Simple interest calculate principal and interest

1. The expected return value is 1300, the actual value is 1300.00, allowing for an error within 1.0.

2. Test procedure:

This is compound interest calculation:

When the allowable error is 1.0, the test succeeds, as shown in:

In the case where no error is allowed, the test is successful and the test results are as follows:

Test three: Compound interest calculation time

1. The expected return value is 23, the actual value is 23.45, allowing for an error within 1.0.

2. Test procedure:

This is compound interest calculation:

With an allowable error of 1.0, the test succeeds and the test results are as follows:

In the absence of an allowable error, the test fails with the test result as shown:

Test four: Compounding annual interest rates

1. The expected return value is 0.04, the actual value is 0.04, allowing for an error within 1.0.

2. Test procedure:

This is compound interest calculation:

With an allowable error of 1.0, the test succeeds and the test results are as follows:

In the case of no error, the test is successful and the test results are as follows:

Other tests are similar and are not tested here.

Sentiment: In doing this unit test is a bumpy road ah, because began to use the C language Compounding program, and then the C language Unit test in the online search, has not been able to find a corresponding tutorial, there has been no solution, and then think, can not waste time, Then the C language version of the program and re-get the Java version, although the time spent more points, but eventually solved, began to test the time, is also very messy, constantly find information, and then try, finally can, the mood is really very excited, the next procedure will continue to improve.

Compound Interest Calculation 4.0 unit test

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.