—————————— 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